state
stringlengths 0
159k
| srcUpToTactic
stringlengths 387
167k
| nextTactic
stringlengths 3
9k
| declUpToTactic
stringlengths 22
11.5k
| declId
stringlengths 38
95
| decl
stringlengths 16
1.89k
| file_tag
stringlengths 17
73
|
---|---|---|---|---|---|---|
case neg.inl
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofiltered C
O : Finset C
H H' : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y))
X Y : C
mX : X ∈ O
mY : Y ∈ O
f : X ⟶ Y
nmf : { fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } ∉ H'
S' : C
T' : {X : C} → X ∈ O → (S' ⟶ X)
w' :
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } ∈ H' → T' mX ≫ f = T' mY
mX' : X ∈ O
mY' : Y ∈ O
f' : X ⟶ Y
hf : ¬f = f'
mf' : f' = f
⊢ { fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f' } } } } ∈ H'
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
·
|
exfalso
|
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
·
|
Mathlib.CategoryTheory.Filtered.Basic.693_0.dhnXC1TuYVuk8Vb
|
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY
|
Mathlib_CategoryTheory_Filtered_Basic
|
case neg.inl.h
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofiltered C
O : Finset C
H H' : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y))
X Y : C
mX : X ∈ O
mY : Y ∈ O
f : X ⟶ Y
nmf : { fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } ∉ H'
S' : C
T' : {X : C} → X ∈ O → (S' ⟶ X)
w' :
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } ∈ H' → T' mX ≫ f = T' mY
mX' : X ∈ O
mY' : Y ∈ O
f' : X ⟶ Y
hf : ¬f = f'
mf' : f' = f
⊢ False
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
|
exact hf mf'.symm
|
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
|
Mathlib.CategoryTheory.Filtered.Basic.693_0.dhnXC1TuYVuk8Vb
|
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY
|
Mathlib_CategoryTheory_Filtered_Basic
|
case neg.inr
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofiltered C
O : Finset C
H H' : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y))
X Y : C
mX : X ∈ O
mY : Y ∈ O
f : X ⟶ Y
nmf : { fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } ∉ H'
S' : C
T' : {X : C} → X ∈ O → (S' ⟶ X)
w' :
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } ∈ H' → T' mX ≫ f = T' mY
mX' : X ∈ O
mY' : Y ∈ O
f' : X ⟶ Y
hf : ¬f = f'
mf' : { fst := X, snd := { fst := Y, snd := { fst := mX', snd := { fst := mY', snd := f' } } } } ∈ H'
⊢ { fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f' } } } } ∈ H'
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
·
|
exact mf'
|
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
·
|
Mathlib.CategoryTheory.Filtered.Basic.693_0.dhnXC1TuYVuk8Vb
|
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY
|
Mathlib_CategoryTheory_Filtered_Basic
|
case neg
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofiltered C
O : Finset C
H H' : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y))
X Y : C
mX : X ∈ O
mY : Y ∈ O
f : X ⟶ Y
nmf : { fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } ∉ H'
S' : C
T' : {X : C} → X ∈ O → (S' ⟶ X)
w' :
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } ∈ H' → T' mX ≫ f = T' mY
X' Y' : C
mX' : X' ∈ O
mY' : Y' ∈ O
f' : X' ⟶ Y'
mf' :
{ fst := X', snd := { fst := Y', snd := { fst := mX', snd := { fst := mY', snd := f' } } } } ∈
insert { fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } H'
h : ¬(X = X' ∧ Y = Y')
⊢ eqHom (T' mX ≫ f) (T' mY) ≫ T' mX' ≫ f' = (fun {X_1} mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ) mY'
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
·
|
rw [@w' _ _ mX' mY' f' _]
|
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
·
|
Mathlib.CategoryTheory.Filtered.Basic.693_0.dhnXC1TuYVuk8Vb
|
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY
|
Mathlib_CategoryTheory_Filtered_Basic
|
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofiltered C
O : Finset C
H H' : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y))
X Y : C
mX : X ∈ O
mY : Y ∈ O
f : X ⟶ Y
nmf : { fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } ∉ H'
S' : C
T' : {X : C} → X ∈ O → (S' ⟶ X)
w' :
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } ∈ H' → T' mX ≫ f = T' mY
X' Y' : C
mX' : X' ∈ O
mY' : Y' ∈ O
f' : X' ⟶ Y'
mf' :
{ fst := X', snd := { fst := Y', snd := { fst := mX', snd := { fst := mY', snd := f' } } } } ∈
insert { fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } H'
h : ¬(X = X' ∧ Y = Y')
⊢ { fst := X', snd := { fst := Y', snd := { fst := mX', snd := { fst := mY', snd := f' } } } } ∈ H'
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
|
apply Finset.mem_of_mem_insert_of_ne mf'
|
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
|
Mathlib.CategoryTheory.Filtered.Basic.693_0.dhnXC1TuYVuk8Vb
|
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY
|
Mathlib_CategoryTheory_Filtered_Basic
|
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofiltered C
O : Finset C
H H' : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y))
X Y : C
mX : X ∈ O
mY : Y ∈ O
f : X ⟶ Y
nmf : { fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } ∉ H'
S' : C
T' : {X : C} → X ∈ O → (S' ⟶ X)
w' :
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } ∈ H' → T' mX ≫ f = T' mY
X' Y' : C
mX' : X' ∈ O
mY' : Y' ∈ O
f' : X' ⟶ Y'
mf' :
{ fst := X', snd := { fst := Y', snd := { fst := mX', snd := { fst := mY', snd := f' } } } } ∈
insert { fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } H'
h : ¬(X = X' ∧ Y = Y')
⊢ { fst := X', snd := { fst := Y', snd := { fst := mX', snd := { fst := mY', snd := f' } } } } ≠
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } }
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
|
contrapose! h
|
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
|
Mathlib.CategoryTheory.Filtered.Basic.693_0.dhnXC1TuYVuk8Vb
|
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY
|
Mathlib_CategoryTheory_Filtered_Basic
|
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofiltered C
O : Finset C
H H' : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y))
X Y : C
mX : X ∈ O
mY : Y ∈ O
f : X ⟶ Y
nmf : { fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } ∉ H'
S' : C
T' : {X : C} → X ∈ O → (S' ⟶ X)
w' :
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } ∈ H' → T' mX ≫ f = T' mY
X' Y' : C
mX' : X' ∈ O
mY' : Y' ∈ O
f' : X' ⟶ Y'
mf' :
{ fst := X', snd := { fst := Y', snd := { fst := mX', snd := { fst := mY', snd := f' } } } } ∈
insert { fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } H'
h :
{ fst := X', snd := { fst := Y', snd := { fst := mX', snd := { fst := mY', snd := f' } } } } =
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } }
⊢ X = X' ∧ Y = Y'
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
|
obtain ⟨rfl, h⟩ := h
|
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
|
Mathlib.CategoryTheory.Filtered.Basic.693_0.dhnXC1TuYVuk8Vb
|
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY
|
Mathlib_CategoryTheory_Filtered_Basic
|
case refl
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofiltered C
O : Finset C
H H' : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y))
X Y : C
mX : X ∈ O
mY : Y ∈ O
f : X ⟶ Y
nmf : { fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } ∉ H'
S' : C
T' : {X : C} → X ∈ O → (S' ⟶ X)
w' :
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } ∈ H' → T' mX ≫ f = T' mY
mf' :
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } ∈
insert { fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } H'
⊢ X = X ∧ Y = Y
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
|
trivial
|
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
|
Mathlib.CategoryTheory.Filtered.Basic.693_0.dhnXC1TuYVuk8Vb
|
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY
|
Mathlib_CategoryTheory_Filtered_Basic
|
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : IsCofiltered C
O : Finset C
H : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y))
J : Type w
inst✝¹ : SmallCategory J
inst✝ : FinCategory J
F : J ⥤ C
⊢ Nonempty (Cone F)
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
|
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
symm
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image,
PSigma.mk.injEq, true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
|
Mathlib.CategoryTheory.Filtered.Basic.754_0.dhnXC1TuYVuk8Vb
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F)
|
Mathlib_CategoryTheory_Filtered_Basic
|
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : IsCofiltered C
O : Finset C
H : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y))
J : Type w
inst✝¹ : SmallCategory J
inst✝ : FinCategory J
F : J ⥤ C
⊢ Nonempty (Cone F)
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
|
let O := Finset.univ.image F.obj
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
|
Mathlib.CategoryTheory.Filtered.Basic.754_0.dhnXC1TuYVuk8Vb
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F)
|
Mathlib_CategoryTheory_Filtered_Basic
|
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : IsCofiltered C
O✝ : Finset C
H : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O✝) ×' (_ : Y ∈ O✝) ×' (X ⟶ Y))
J : Type w
inst✝¹ : SmallCategory J
inst✝ : FinCategory J
F : J ⥤ C
O : Finset C := Finset.image F.obj Finset.univ
⊢ Nonempty (Cone F)
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
|
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
|
Mathlib.CategoryTheory.Filtered.Basic.754_0.dhnXC1TuYVuk8Vb
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F)
|
Mathlib_CategoryTheory_Filtered_Basic
|
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : IsCofiltered C
O✝ : Finset C
H : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O✝) ×' (_ : Y ∈ O✝) ×' (X ⟶ Y))
J : Type w
inst✝¹ : SmallCategory J
inst✝ : FinCategory J
F : J ⥤ C
O : Finset C := Finset.image F.obj Finset.univ
X Y : J
f : X ⟶ Y
⊢ F.obj X ∈ O
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by
|
simp
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by
|
Mathlib.CategoryTheory.Filtered.Basic.754_0.dhnXC1TuYVuk8Vb
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F)
|
Mathlib_CategoryTheory_Filtered_Basic
|
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : IsCofiltered C
O✝ : Finset C
H : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O✝) ×' (_ : Y ∈ O✝) ×' (X ⟶ Y))
J : Type w
inst✝¹ : SmallCategory J
inst✝ : FinCategory J
F : J ⥤ C
O : Finset C := Finset.image F.obj Finset.univ
X Y : J
f : X ⟶ Y
⊢ F.obj Y ∈ O
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by
|
simp
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by
|
Mathlib.CategoryTheory.Filtered.Basic.754_0.dhnXC1TuYVuk8Vb
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F)
|
Mathlib_CategoryTheory_Filtered_Basic
|
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : IsCofiltered C
O✝ : Finset C
H✝ : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O✝) ×' (_ : Y ∈ O✝) ×' (X ⟶ Y))
J : Type w
inst✝¹ : SmallCategory J
inst✝ : FinCategory J
F : J ⥤ C
O : Finset C := Finset.image F.obj Finset.univ
H : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y)) :=
Finset.biUnion Finset.univ fun X =>
Finset.biUnion Finset.univ fun Y =>
Finset.image
(fun f =>
{ fst := F.obj X,
snd :=
{ fst := F.obj Y,
snd :=
{ fst := (_ : F.obj X ∈ Finset.image F.obj Finset.univ),
snd := { fst := (_ : F.obj Y ∈ Finset.image F.obj Finset.univ), snd := F.map f } } } })
Finset.univ
⊢ Nonempty (Cone F)
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
|
obtain ⟨Z, f, w⟩ := inf_exists O H
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
|
Mathlib.CategoryTheory.Filtered.Basic.754_0.dhnXC1TuYVuk8Vb
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F)
|
Mathlib_CategoryTheory_Filtered_Basic
|
case intro.intro
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : IsCofiltered C
O✝ : Finset C
H✝ : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O✝) ×' (_ : Y ∈ O✝) ×' (X ⟶ Y))
J : Type w
inst✝¹ : SmallCategory J
inst✝ : FinCategory J
F : J ⥤ C
O : Finset C := Finset.image F.obj Finset.univ
H : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y)) :=
Finset.biUnion Finset.univ fun X =>
Finset.biUnion Finset.univ fun Y =>
Finset.image
(fun f =>
{ fst := F.obj X,
snd :=
{ fst := F.obj Y,
snd :=
{ fst := (_ : F.obj X ∈ Finset.image F.obj Finset.univ),
snd := { fst := (_ : F.obj Y ∈ Finset.image F.obj Finset.univ), snd := F.map f } } } })
Finset.univ
Z : C
f : {X : C} → X ∈ O → (Z ⟶ X)
w :
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f_1 : X ⟶ Y},
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f_1 } } } } ∈ H → f mX ≫ f_1 = f mY
⊢ Nonempty (Cone F)
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
|
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
|
Mathlib.CategoryTheory.Filtered.Basic.754_0.dhnXC1TuYVuk8Vb
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F)
|
Mathlib_CategoryTheory_Filtered_Basic
|
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : IsCofiltered C
O✝ : Finset C
H✝ : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O✝) ×' (_ : Y ∈ O✝) ×' (X ⟶ Y))
J : Type w
inst✝¹ : SmallCategory J
inst✝ : FinCategory J
F : J ⥤ C
O : Finset C := Finset.image F.obj Finset.univ
H : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y)) :=
Finset.biUnion Finset.univ fun X =>
Finset.biUnion Finset.univ fun Y =>
Finset.image
(fun f =>
{ fst := F.obj X,
snd :=
{ fst := F.obj Y,
snd :=
{ fst := (_ : F.obj X ∈ Finset.image F.obj Finset.univ),
snd := { fst := (_ : F.obj Y ∈ Finset.image F.obj Finset.univ), snd := F.map f } } } })
Finset.univ
Z : C
f : {X : C} → X ∈ O → (Z ⟶ X)
w :
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f_1 : X ⟶ Y},
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f_1 } } } } ∈ H → f mX ≫ f_1 = f mY
X : J
⊢ F.obj X ∈ O
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by
|
simp
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by
|
Mathlib.CategoryTheory.Filtered.Basic.754_0.dhnXC1TuYVuk8Vb
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F)
|
Mathlib_CategoryTheory_Filtered_Basic
|
case intro.intro
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : IsCofiltered C
O✝ : Finset C
H✝ : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O✝) ×' (_ : Y ∈ O✝) ×' (X ⟶ Y))
J : Type w
inst✝¹ : SmallCategory J
inst✝ : FinCategory J
F : J ⥤ C
O : Finset C := Finset.image F.obj Finset.univ
H : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y)) :=
Finset.biUnion Finset.univ fun X =>
Finset.biUnion Finset.univ fun Y =>
Finset.image
(fun f =>
{ fst := F.obj X,
snd :=
{ fst := F.obj Y,
snd :=
{ fst := (_ : F.obj X ∈ Finset.image F.obj Finset.univ),
snd := { fst := (_ : F.obj Y ∈ Finset.image F.obj Finset.univ), snd := F.map f } } } })
Finset.univ
Z : C
f : {X : C} → X ∈ O → (Z ⟶ X)
w :
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f_1 : X ⟶ Y},
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f_1 } } } } ∈ H → f mX ≫ f_1 = f mY
⊢ ∀ ⦃X Y : J⦄ (f_1 : X ⟶ Y),
((Functor.const J).obj Z).map f_1 ≫ (fun X => f (_ : F.obj X ∈ Finset.image F.obj Finset.univ)) Y =
(fun X => f (_ : F.obj X ∈ Finset.image F.obj Finset.univ)) X ≫ F.map f_1
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
|
intro j j' g
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
|
Mathlib.CategoryTheory.Filtered.Basic.754_0.dhnXC1TuYVuk8Vb
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F)
|
Mathlib_CategoryTheory_Filtered_Basic
|
case intro.intro
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : IsCofiltered C
O✝ : Finset C
H✝ : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O✝) ×' (_ : Y ∈ O✝) ×' (X ⟶ Y))
J : Type w
inst✝¹ : SmallCategory J
inst✝ : FinCategory J
F : J ⥤ C
O : Finset C := Finset.image F.obj Finset.univ
H : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y)) :=
Finset.biUnion Finset.univ fun X =>
Finset.biUnion Finset.univ fun Y =>
Finset.image
(fun f =>
{ fst := F.obj X,
snd :=
{ fst := F.obj Y,
snd :=
{ fst := (_ : F.obj X ∈ Finset.image F.obj Finset.univ),
snd := { fst := (_ : F.obj Y ∈ Finset.image F.obj Finset.univ), snd := F.map f } } } })
Finset.univ
Z : C
f : {X : C} → X ∈ O → (Z ⟶ X)
w :
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f_1 : X ⟶ Y},
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f_1 } } } } ∈ H → f mX ≫ f_1 = f mY
j j' : J
g : j ⟶ j'
⊢ ((Functor.const J).obj Z).map g ≫ (fun X => f (_ : F.obj X ∈ Finset.image F.obj Finset.univ)) j' =
(fun X => f (_ : F.obj X ∈ Finset.image F.obj Finset.univ)) j ≫ F.map g
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
|
dsimp
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
|
Mathlib.CategoryTheory.Filtered.Basic.754_0.dhnXC1TuYVuk8Vb
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F)
|
Mathlib_CategoryTheory_Filtered_Basic
|
case intro.intro
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : IsCofiltered C
O✝ : Finset C
H✝ : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O✝) ×' (_ : Y ∈ O✝) ×' (X ⟶ Y))
J : Type w
inst✝¹ : SmallCategory J
inst✝ : FinCategory J
F : J ⥤ C
O : Finset C := Finset.image F.obj Finset.univ
H : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y)) :=
Finset.biUnion Finset.univ fun X =>
Finset.biUnion Finset.univ fun Y =>
Finset.image
(fun f =>
{ fst := F.obj X,
snd :=
{ fst := F.obj Y,
snd :=
{ fst := (_ : F.obj X ∈ Finset.image F.obj Finset.univ),
snd := { fst := (_ : F.obj Y ∈ Finset.image F.obj Finset.univ), snd := F.map f } } } })
Finset.univ
Z : C
f : {X : C} → X ∈ O → (Z ⟶ X)
w :
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f_1 : X ⟶ Y},
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f_1 } } } } ∈ H → f mX ≫ f_1 = f mY
j j' : J
g : j ⟶ j'
⊢ 𝟙 Z ≫ f (_ : F.obj j' ∈ Finset.image F.obj Finset.univ) = f (_ : F.obj j ∈ Finset.image F.obj Finset.univ) ≫ F.map g
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
|
simp only [Category.id_comp]
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
|
Mathlib.CategoryTheory.Filtered.Basic.754_0.dhnXC1TuYVuk8Vb
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F)
|
Mathlib_CategoryTheory_Filtered_Basic
|
case intro.intro
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : IsCofiltered C
O✝ : Finset C
H✝ : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O✝) ×' (_ : Y ∈ O✝) ×' (X ⟶ Y))
J : Type w
inst✝¹ : SmallCategory J
inst✝ : FinCategory J
F : J ⥤ C
O : Finset C := Finset.image F.obj Finset.univ
H : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y)) :=
Finset.biUnion Finset.univ fun X =>
Finset.biUnion Finset.univ fun Y =>
Finset.image
(fun f =>
{ fst := F.obj X,
snd :=
{ fst := F.obj Y,
snd :=
{ fst := (_ : F.obj X ∈ Finset.image F.obj Finset.univ),
snd := { fst := (_ : F.obj Y ∈ Finset.image F.obj Finset.univ), snd := F.map f } } } })
Finset.univ
Z : C
f : {X : C} → X ∈ O → (Z ⟶ X)
w :
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f_1 : X ⟶ Y},
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f_1 } } } } ∈ H → f mX ≫ f_1 = f mY
j j' : J
g : j ⟶ j'
⊢ f (_ : F.obj j' ∈ Finset.image F.obj Finset.univ) = f (_ : F.obj j ∈ Finset.image F.obj Finset.univ) ≫ F.map g
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
|
symm
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
|
Mathlib.CategoryTheory.Filtered.Basic.754_0.dhnXC1TuYVuk8Vb
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F)
|
Mathlib_CategoryTheory_Filtered_Basic
|
case intro.intro
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : IsCofiltered C
O✝ : Finset C
H✝ : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O✝) ×' (_ : Y ∈ O✝) ×' (X ⟶ Y))
J : Type w
inst✝¹ : SmallCategory J
inst✝ : FinCategory J
F : J ⥤ C
O : Finset C := Finset.image F.obj Finset.univ
H : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y)) :=
Finset.biUnion Finset.univ fun X =>
Finset.biUnion Finset.univ fun Y =>
Finset.image
(fun f =>
{ fst := F.obj X,
snd :=
{ fst := F.obj Y,
snd :=
{ fst := (_ : F.obj X ∈ Finset.image F.obj Finset.univ),
snd := { fst := (_ : F.obj Y ∈ Finset.image F.obj Finset.univ), snd := F.map f } } } })
Finset.univ
Z : C
f : {X : C} → X ∈ O → (Z ⟶ X)
w :
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f_1 : X ⟶ Y},
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f_1 } } } } ∈ H → f mX ≫ f_1 = f mY
j j' : J
g : j ⟶ j'
⊢ f (_ : F.obj j ∈ Finset.image F.obj Finset.univ) ≫ F.map g = f (_ : F.obj j' ∈ Finset.image F.obj Finset.univ)
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
symm
|
apply w
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
symm
|
Mathlib.CategoryTheory.Filtered.Basic.754_0.dhnXC1TuYVuk8Vb
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F)
|
Mathlib_CategoryTheory_Filtered_Basic
|
case intro.intro.a
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : IsCofiltered C
O✝ : Finset C
H✝ : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O✝) ×' (_ : Y ∈ O✝) ×' (X ⟶ Y))
J : Type w
inst✝¹ : SmallCategory J
inst✝ : FinCategory J
F : J ⥤ C
O : Finset C := Finset.image F.obj Finset.univ
H : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y)) :=
Finset.biUnion Finset.univ fun X =>
Finset.biUnion Finset.univ fun Y =>
Finset.image
(fun f =>
{ fst := F.obj X,
snd :=
{ fst := F.obj Y,
snd :=
{ fst := (_ : F.obj X ∈ Finset.image F.obj Finset.univ),
snd := { fst := (_ : F.obj Y ∈ Finset.image F.obj Finset.univ), snd := F.map f } } } })
Finset.univ
Z : C
f : {X : C} → X ∈ O → (Z ⟶ X)
w :
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f_1 : X ⟶ Y},
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f_1 } } } } ∈ H → f mX ≫ f_1 = f mY
j j' : J
g : j ⟶ j'
⊢ { fst := F.obj j,
snd :=
{ fst := F.obj j',
snd :=
{ fst := (_ : F.obj j ∈ Finset.image F.obj Finset.univ),
snd := { fst := (_ : F.obj j' ∈ Finset.image F.obj Finset.univ), snd := F.map g } } } } ∈
H
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
symm
apply w
|
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image,
PSigma.mk.injEq, true_and, exists_and_left]
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
symm
apply w
|
Mathlib.CategoryTheory.Filtered.Basic.754_0.dhnXC1TuYVuk8Vb
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F)
|
Mathlib_CategoryTheory_Filtered_Basic
|
case intro.intro.a
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : IsCofiltered C
O✝ : Finset C
H✝ : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O✝) ×' (_ : Y ∈ O✝) ×' (X ⟶ Y))
J : Type w
inst✝¹ : SmallCategory J
inst✝ : FinCategory J
F : J ⥤ C
O : Finset C := Finset.image F.obj Finset.univ
H : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y)) :=
Finset.biUnion Finset.univ fun X =>
Finset.biUnion Finset.univ fun Y =>
Finset.image
(fun f =>
{ fst := F.obj X,
snd :=
{ fst := F.obj Y,
snd :=
{ fst := (_ : F.obj X ∈ Finset.image F.obj Finset.univ),
snd := { fst := (_ : F.obj Y ∈ Finset.image F.obj Finset.univ), snd := F.map f } } } })
Finset.univ
Z : C
f : {X : C} → X ∈ O → (Z ⟶ X)
w :
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f_1 : X ⟶ Y},
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f_1 } } } } ∈ H → f mX ≫ f_1 = f mY
j j' : J
g : j ⟶ j'
⊢ ∃ a,
F.obj a = F.obj j ∧
∃ x x_1,
HEq
{ fst := F.obj x,
snd :=
{ fst := (_ : F.obj a ∈ Finset.image F.obj Finset.univ),
snd := { fst := (_ : F.obj x ∈ Finset.image F.obj Finset.univ), snd := F.map x_1 } } }
{ fst := F.obj j',
snd :=
{ fst := (_ : F.obj j ∈ Finset.image F.obj Finset.univ),
snd := { fst := (_ : F.obj j' ∈ Finset.image F.obj Finset.univ), snd := F.map g } } }
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
symm
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image,
PSigma.mk.injEq, true_and, exists_and_left]
|
exact ⟨j, rfl, j', g, by simp⟩
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
symm
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image,
PSigma.mk.injEq, true_and, exists_and_left]
|
Mathlib.CategoryTheory.Filtered.Basic.754_0.dhnXC1TuYVuk8Vb
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F)
|
Mathlib_CategoryTheory_Filtered_Basic
|
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : IsCofiltered C
O✝ : Finset C
H✝ : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O✝) ×' (_ : Y ∈ O✝) ×' (X ⟶ Y))
J : Type w
inst✝¹ : SmallCategory J
inst✝ : FinCategory J
F : J ⥤ C
O : Finset C := Finset.image F.obj Finset.univ
H : Finset ((X : C) ×' (Y : C) ×' (_ : X ∈ O) ×' (_ : Y ∈ O) ×' (X ⟶ Y)) :=
Finset.biUnion Finset.univ fun X =>
Finset.biUnion Finset.univ fun Y =>
Finset.image
(fun f =>
{ fst := F.obj X,
snd :=
{ fst := F.obj Y,
snd :=
{ fst := (_ : F.obj X ∈ Finset.image F.obj Finset.univ),
snd := { fst := (_ : F.obj Y ∈ Finset.image F.obj Finset.univ), snd := F.map f } } } })
Finset.univ
Z : C
f : {X : C} → X ∈ O → (Z ⟶ X)
w :
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f_1 : X ⟶ Y},
{ fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f_1 } } } } ∈ H → f mX ≫ f_1 = f mY
j j' : J
g : j ⟶ j'
⊢ HEq
{ fst := F.obj j',
snd :=
{ fst := (_ : F.obj j ∈ Finset.image F.obj Finset.univ),
snd := { fst := (_ : F.obj j' ∈ Finset.image F.obj Finset.univ), snd := F.map g } } }
{ fst := F.obj j',
snd :=
{ fst := (_ : F.obj j ∈ Finset.image F.obj Finset.univ),
snd := { fst := (_ : F.obj j' ∈ Finset.image F.obj Finset.univ), snd := F.map g } } }
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
symm
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image,
PSigma.mk.injEq, true_and, exists_and_left]
exact ⟨j, rfl, j', g, by
|
simp
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
symm
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image,
PSigma.mk.injEq, true_and, exists_and_left]
exact ⟨j, rfl, j', g, by
|
Mathlib.CategoryTheory.Filtered.Basic.754_0.dhnXC1TuYVuk8Vb
|
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F)
|
Mathlib_CategoryTheory_Filtered_Basic
|
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsFilteredOrEmpty C
X Y : Cᵒᵖ
f g : X ⟶ Y
⊢ (IsFiltered.coeqHom f.unop g.unop).op ≫ f = (IsFiltered.coeqHom f.unop g.unop).op ≫ g
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
symm
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image,
PSigma.mk.injEq, true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_cofiltered.cone_nonempty CategoryTheory.IsCofiltered.cone_nonempty
/-- An arbitrary choice of cone over `F : J ⥤ C`, for `FinCategory J` and `IsCofiltered C`.
-/
noncomputable def cone (F : J ⥤ C) : Cone F :=
(cone_nonempty F).some
#align category_theory.is_cofiltered.cone CategoryTheory.IsCofiltered.cone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofiltered D :=
{ IsCofilteredOrEmpty.of_left_adjoint h with
nonempty := IsCofiltered.nonempty.map L.obj }
#align category_theory.is_cofiltered.of_left_adjoint CategoryTheory.IsCofiltered.of_left_adjoint
/-- If `C` is cofiltered, and we have a left adjoint functor `L : C ⥤ D`, then `D` is cofiltered. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofiltered D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
#align category_theory.is_cofiltered.of_is_left_adjoint CategoryTheory.IsCofiltered.of_isLeftAdjoint
/-- Being cofiltered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofiltered D :=
of_left_adjoint h.toAdjunction
#align category_theory.is_cofiltered.of_equivalence CategoryTheory.IsCofiltered.of_equivalence
end Nonempty
end IsCofiltered
section Opposite
open Opposite
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y :=
⟨op (IsFiltered.max X.unop Y.unop), (IsFiltered.leftToMax _ _).op,
(IsFiltered.rightToMax _ _).op, trivial⟩
cone_maps X Y f g :=
⟨op (IsFiltered.coeq f.unop g.unop), (IsFiltered.coeqHom _ _).op, by
|
rw [show f = f.unop.op by simp, show g = g.unop.op by simp, ← op_comp, ← op_comp]
|
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y :=
⟨op (IsFiltered.max X.unop Y.unop), (IsFiltered.leftToMax _ _).op,
(IsFiltered.rightToMax _ _).op, trivial⟩
cone_maps X Y f g :=
⟨op (IsFiltered.coeq f.unop g.unop), (IsFiltered.coeqHom _ _).op, by
|
Mathlib.CategoryTheory.Filtered.Basic.810_0.dhnXC1TuYVuk8Vb
|
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y
|
Mathlib_CategoryTheory_Filtered_Basic
|
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsFilteredOrEmpty C
X Y : Cᵒᵖ
f g : X ⟶ Y
⊢ f = f.unop.op
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
symm
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image,
PSigma.mk.injEq, true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_cofiltered.cone_nonempty CategoryTheory.IsCofiltered.cone_nonempty
/-- An arbitrary choice of cone over `F : J ⥤ C`, for `FinCategory J` and `IsCofiltered C`.
-/
noncomputable def cone (F : J ⥤ C) : Cone F :=
(cone_nonempty F).some
#align category_theory.is_cofiltered.cone CategoryTheory.IsCofiltered.cone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofiltered D :=
{ IsCofilteredOrEmpty.of_left_adjoint h with
nonempty := IsCofiltered.nonempty.map L.obj }
#align category_theory.is_cofiltered.of_left_adjoint CategoryTheory.IsCofiltered.of_left_adjoint
/-- If `C` is cofiltered, and we have a left adjoint functor `L : C ⥤ D`, then `D` is cofiltered. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofiltered D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
#align category_theory.is_cofiltered.of_is_left_adjoint CategoryTheory.IsCofiltered.of_isLeftAdjoint
/-- Being cofiltered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofiltered D :=
of_left_adjoint h.toAdjunction
#align category_theory.is_cofiltered.of_equivalence CategoryTheory.IsCofiltered.of_equivalence
end Nonempty
end IsCofiltered
section Opposite
open Opposite
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y :=
⟨op (IsFiltered.max X.unop Y.unop), (IsFiltered.leftToMax _ _).op,
(IsFiltered.rightToMax _ _).op, trivial⟩
cone_maps X Y f g :=
⟨op (IsFiltered.coeq f.unop g.unop), (IsFiltered.coeqHom _ _).op, by
rw [show f = f.unop.op by
|
simp
|
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y :=
⟨op (IsFiltered.max X.unop Y.unop), (IsFiltered.leftToMax _ _).op,
(IsFiltered.rightToMax _ _).op, trivial⟩
cone_maps X Y f g :=
⟨op (IsFiltered.coeq f.unop g.unop), (IsFiltered.coeqHom _ _).op, by
rw [show f = f.unop.op by
|
Mathlib.CategoryTheory.Filtered.Basic.810_0.dhnXC1TuYVuk8Vb
|
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y
|
Mathlib_CategoryTheory_Filtered_Basic
|
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsFilteredOrEmpty C
X Y : Cᵒᵖ
f g : X ⟶ Y
⊢ g = g.unop.op
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
symm
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image,
PSigma.mk.injEq, true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_cofiltered.cone_nonempty CategoryTheory.IsCofiltered.cone_nonempty
/-- An arbitrary choice of cone over `F : J ⥤ C`, for `FinCategory J` and `IsCofiltered C`.
-/
noncomputable def cone (F : J ⥤ C) : Cone F :=
(cone_nonempty F).some
#align category_theory.is_cofiltered.cone CategoryTheory.IsCofiltered.cone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofiltered D :=
{ IsCofilteredOrEmpty.of_left_adjoint h with
nonempty := IsCofiltered.nonempty.map L.obj }
#align category_theory.is_cofiltered.of_left_adjoint CategoryTheory.IsCofiltered.of_left_adjoint
/-- If `C` is cofiltered, and we have a left adjoint functor `L : C ⥤ D`, then `D` is cofiltered. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofiltered D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
#align category_theory.is_cofiltered.of_is_left_adjoint CategoryTheory.IsCofiltered.of_isLeftAdjoint
/-- Being cofiltered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofiltered D :=
of_left_adjoint h.toAdjunction
#align category_theory.is_cofiltered.of_equivalence CategoryTheory.IsCofiltered.of_equivalence
end Nonempty
end IsCofiltered
section Opposite
open Opposite
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y :=
⟨op (IsFiltered.max X.unop Y.unop), (IsFiltered.leftToMax _ _).op,
(IsFiltered.rightToMax _ _).op, trivial⟩
cone_maps X Y f g :=
⟨op (IsFiltered.coeq f.unop g.unop), (IsFiltered.coeqHom _ _).op, by
rw [show f = f.unop.op by simp, show g = g.unop.op by
|
simp
|
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y :=
⟨op (IsFiltered.max X.unop Y.unop), (IsFiltered.leftToMax _ _).op,
(IsFiltered.rightToMax _ _).op, trivial⟩
cone_maps X Y f g :=
⟨op (IsFiltered.coeq f.unop g.unop), (IsFiltered.coeqHom _ _).op, by
rw [show f = f.unop.op by simp, show g = g.unop.op by
|
Mathlib.CategoryTheory.Filtered.Basic.810_0.dhnXC1TuYVuk8Vb
|
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y
|
Mathlib_CategoryTheory_Filtered_Basic
|
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsFilteredOrEmpty C
X Y : Cᵒᵖ
f g : X ⟶ Y
⊢ (f.unop ≫ IsFiltered.coeqHom f.unop.op.unop g.unop.op.unop).op =
(g.unop ≫ IsFiltered.coeqHom f.unop.op.unop g.unop.op.unop).op
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
symm
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image,
PSigma.mk.injEq, true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_cofiltered.cone_nonempty CategoryTheory.IsCofiltered.cone_nonempty
/-- An arbitrary choice of cone over `F : J ⥤ C`, for `FinCategory J` and `IsCofiltered C`.
-/
noncomputable def cone (F : J ⥤ C) : Cone F :=
(cone_nonempty F).some
#align category_theory.is_cofiltered.cone CategoryTheory.IsCofiltered.cone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofiltered D :=
{ IsCofilteredOrEmpty.of_left_adjoint h with
nonempty := IsCofiltered.nonempty.map L.obj }
#align category_theory.is_cofiltered.of_left_adjoint CategoryTheory.IsCofiltered.of_left_adjoint
/-- If `C` is cofiltered, and we have a left adjoint functor `L : C ⥤ D`, then `D` is cofiltered. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofiltered D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
#align category_theory.is_cofiltered.of_is_left_adjoint CategoryTheory.IsCofiltered.of_isLeftAdjoint
/-- Being cofiltered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofiltered D :=
of_left_adjoint h.toAdjunction
#align category_theory.is_cofiltered.of_equivalence CategoryTheory.IsCofiltered.of_equivalence
end Nonempty
end IsCofiltered
section Opposite
open Opposite
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y :=
⟨op (IsFiltered.max X.unop Y.unop), (IsFiltered.leftToMax _ _).op,
(IsFiltered.rightToMax _ _).op, trivial⟩
cone_maps X Y f g :=
⟨op (IsFiltered.coeq f.unop g.unop), (IsFiltered.coeqHom _ _).op, by
rw [show f = f.unop.op by simp, show g = g.unop.op by simp, ← op_comp, ← op_comp]
|
congr 1
|
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y :=
⟨op (IsFiltered.max X.unop Y.unop), (IsFiltered.leftToMax _ _).op,
(IsFiltered.rightToMax _ _).op, trivial⟩
cone_maps X Y f g :=
⟨op (IsFiltered.coeq f.unop g.unop), (IsFiltered.coeqHom _ _).op, by
rw [show f = f.unop.op by simp, show g = g.unop.op by simp, ← op_comp, ← op_comp]
|
Mathlib.CategoryTheory.Filtered.Basic.810_0.dhnXC1TuYVuk8Vb
|
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y
|
Mathlib_CategoryTheory_Filtered_Basic
|
case e_f
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsFilteredOrEmpty C
X Y : Cᵒᵖ
f g : X ⟶ Y
⊢ f.unop ≫ IsFiltered.coeqHom f.unop.op.unop g.unop.op.unop = g.unop ≫ IsFiltered.coeqHom f.unop.op.unop g.unop.op.unop
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
symm
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image,
PSigma.mk.injEq, true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_cofiltered.cone_nonempty CategoryTheory.IsCofiltered.cone_nonempty
/-- An arbitrary choice of cone over `F : J ⥤ C`, for `FinCategory J` and `IsCofiltered C`.
-/
noncomputable def cone (F : J ⥤ C) : Cone F :=
(cone_nonempty F).some
#align category_theory.is_cofiltered.cone CategoryTheory.IsCofiltered.cone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofiltered D :=
{ IsCofilteredOrEmpty.of_left_adjoint h with
nonempty := IsCofiltered.nonempty.map L.obj }
#align category_theory.is_cofiltered.of_left_adjoint CategoryTheory.IsCofiltered.of_left_adjoint
/-- If `C` is cofiltered, and we have a left adjoint functor `L : C ⥤ D`, then `D` is cofiltered. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofiltered D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
#align category_theory.is_cofiltered.of_is_left_adjoint CategoryTheory.IsCofiltered.of_isLeftAdjoint
/-- Being cofiltered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofiltered D :=
of_left_adjoint h.toAdjunction
#align category_theory.is_cofiltered.of_equivalence CategoryTheory.IsCofiltered.of_equivalence
end Nonempty
end IsCofiltered
section Opposite
open Opposite
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y :=
⟨op (IsFiltered.max X.unop Y.unop), (IsFiltered.leftToMax _ _).op,
(IsFiltered.rightToMax _ _).op, trivial⟩
cone_maps X Y f g :=
⟨op (IsFiltered.coeq f.unop g.unop), (IsFiltered.coeqHom _ _).op, by
rw [show f = f.unop.op by simp, show g = g.unop.op by simp, ← op_comp, ← op_comp]
congr 1
|
exact IsFiltered.coeq_condition f.unop g.unop
|
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y :=
⟨op (IsFiltered.max X.unop Y.unop), (IsFiltered.leftToMax _ _).op,
(IsFiltered.rightToMax _ _).op, trivial⟩
cone_maps X Y f g :=
⟨op (IsFiltered.coeq f.unop g.unop), (IsFiltered.coeqHom _ _).op, by
rw [show f = f.unop.op by simp, show g = g.unop.op by simp, ← op_comp, ← op_comp]
congr 1
|
Mathlib.CategoryTheory.Filtered.Basic.810_0.dhnXC1TuYVuk8Vb
|
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y
|
Mathlib_CategoryTheory_Filtered_Basic
|
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofilteredOrEmpty C
X Y : Cᵒᵖ
f g : X ⟶ Y
⊢ f ≫ (IsCofiltered.eqHom f.unop g.unop).op = g ≫ (IsCofiltered.eqHom f.unop g.unop).op
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
symm
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image,
PSigma.mk.injEq, true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_cofiltered.cone_nonempty CategoryTheory.IsCofiltered.cone_nonempty
/-- An arbitrary choice of cone over `F : J ⥤ C`, for `FinCategory J` and `IsCofiltered C`.
-/
noncomputable def cone (F : J ⥤ C) : Cone F :=
(cone_nonempty F).some
#align category_theory.is_cofiltered.cone CategoryTheory.IsCofiltered.cone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofiltered D :=
{ IsCofilteredOrEmpty.of_left_adjoint h with
nonempty := IsCofiltered.nonempty.map L.obj }
#align category_theory.is_cofiltered.of_left_adjoint CategoryTheory.IsCofiltered.of_left_adjoint
/-- If `C` is cofiltered, and we have a left adjoint functor `L : C ⥤ D`, then `D` is cofiltered. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofiltered D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
#align category_theory.is_cofiltered.of_is_left_adjoint CategoryTheory.IsCofiltered.of_isLeftAdjoint
/-- Being cofiltered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofiltered D :=
of_left_adjoint h.toAdjunction
#align category_theory.is_cofiltered.of_equivalence CategoryTheory.IsCofiltered.of_equivalence
end Nonempty
end IsCofiltered
section Opposite
open Opposite
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y :=
⟨op (IsFiltered.max X.unop Y.unop), (IsFiltered.leftToMax _ _).op,
(IsFiltered.rightToMax _ _).op, trivial⟩
cone_maps X Y f g :=
⟨op (IsFiltered.coeq f.unop g.unop), (IsFiltered.coeqHom _ _).op, by
rw [show f = f.unop.op by simp, show g = g.unop.op by simp, ← op_comp, ← op_comp]
congr 1
exact IsFiltered.coeq_condition f.unop g.unop⟩
instance isCofiltered_op_of_isFiltered [IsFiltered C] : IsCofiltered Cᵒᵖ where
nonempty := letI : Nonempty C := IsFiltered.nonempty; inferInstance
#align category_theory.is_cofiltered_op_of_is_filtered CategoryTheory.isCofiltered_op_of_isFiltered
instance isFilteredOrEmpty_op_of_isCofilteredOrEmpty [IsCofilteredOrEmpty C] :
IsFilteredOrEmpty Cᵒᵖ where
cocone_objs X Y :=
⟨op (IsCofiltered.min X.unop Y.unop), (IsCofiltered.minToLeft X.unop Y.unop).op,
(IsCofiltered.minToRight X.unop Y.unop).op, trivial⟩
cocone_maps X Y f g :=
⟨op (IsCofiltered.eq f.unop g.unop), (IsCofiltered.eqHom f.unop g.unop).op, by
|
rw [show f = f.unop.op by simp, show g = g.unop.op by simp, ← op_comp, ← op_comp]
|
instance isFilteredOrEmpty_op_of_isCofilteredOrEmpty [IsCofilteredOrEmpty C] :
IsFilteredOrEmpty Cᵒᵖ where
cocone_objs X Y :=
⟨op (IsCofiltered.min X.unop Y.unop), (IsCofiltered.minToLeft X.unop Y.unop).op,
(IsCofiltered.minToRight X.unop Y.unop).op, trivial⟩
cocone_maps X Y f g :=
⟨op (IsCofiltered.eq f.unop g.unop), (IsCofiltered.eqHom f.unop g.unop).op, by
|
Mathlib.CategoryTheory.Filtered.Basic.825_0.dhnXC1TuYVuk8Vb
|
instance isFilteredOrEmpty_op_of_isCofilteredOrEmpty [IsCofilteredOrEmpty C] :
IsFilteredOrEmpty Cᵒᵖ where
cocone_objs X Y
|
Mathlib_CategoryTheory_Filtered_Basic
|
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofilteredOrEmpty C
X Y : Cᵒᵖ
f g : X ⟶ Y
⊢ f = f.unop.op
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
symm
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image,
PSigma.mk.injEq, true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_cofiltered.cone_nonempty CategoryTheory.IsCofiltered.cone_nonempty
/-- An arbitrary choice of cone over `F : J ⥤ C`, for `FinCategory J` and `IsCofiltered C`.
-/
noncomputable def cone (F : J ⥤ C) : Cone F :=
(cone_nonempty F).some
#align category_theory.is_cofiltered.cone CategoryTheory.IsCofiltered.cone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofiltered D :=
{ IsCofilteredOrEmpty.of_left_adjoint h with
nonempty := IsCofiltered.nonempty.map L.obj }
#align category_theory.is_cofiltered.of_left_adjoint CategoryTheory.IsCofiltered.of_left_adjoint
/-- If `C` is cofiltered, and we have a left adjoint functor `L : C ⥤ D`, then `D` is cofiltered. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofiltered D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
#align category_theory.is_cofiltered.of_is_left_adjoint CategoryTheory.IsCofiltered.of_isLeftAdjoint
/-- Being cofiltered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofiltered D :=
of_left_adjoint h.toAdjunction
#align category_theory.is_cofiltered.of_equivalence CategoryTheory.IsCofiltered.of_equivalence
end Nonempty
end IsCofiltered
section Opposite
open Opposite
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y :=
⟨op (IsFiltered.max X.unop Y.unop), (IsFiltered.leftToMax _ _).op,
(IsFiltered.rightToMax _ _).op, trivial⟩
cone_maps X Y f g :=
⟨op (IsFiltered.coeq f.unop g.unop), (IsFiltered.coeqHom _ _).op, by
rw [show f = f.unop.op by simp, show g = g.unop.op by simp, ← op_comp, ← op_comp]
congr 1
exact IsFiltered.coeq_condition f.unop g.unop⟩
instance isCofiltered_op_of_isFiltered [IsFiltered C] : IsCofiltered Cᵒᵖ where
nonempty := letI : Nonempty C := IsFiltered.nonempty; inferInstance
#align category_theory.is_cofiltered_op_of_is_filtered CategoryTheory.isCofiltered_op_of_isFiltered
instance isFilteredOrEmpty_op_of_isCofilteredOrEmpty [IsCofilteredOrEmpty C] :
IsFilteredOrEmpty Cᵒᵖ where
cocone_objs X Y :=
⟨op (IsCofiltered.min X.unop Y.unop), (IsCofiltered.minToLeft X.unop Y.unop).op,
(IsCofiltered.minToRight X.unop Y.unop).op, trivial⟩
cocone_maps X Y f g :=
⟨op (IsCofiltered.eq f.unop g.unop), (IsCofiltered.eqHom f.unop g.unop).op, by
rw [show f = f.unop.op by
|
simp
|
instance isFilteredOrEmpty_op_of_isCofilteredOrEmpty [IsCofilteredOrEmpty C] :
IsFilteredOrEmpty Cᵒᵖ where
cocone_objs X Y :=
⟨op (IsCofiltered.min X.unop Y.unop), (IsCofiltered.minToLeft X.unop Y.unop).op,
(IsCofiltered.minToRight X.unop Y.unop).op, trivial⟩
cocone_maps X Y f g :=
⟨op (IsCofiltered.eq f.unop g.unop), (IsCofiltered.eqHom f.unop g.unop).op, by
rw [show f = f.unop.op by
|
Mathlib.CategoryTheory.Filtered.Basic.825_0.dhnXC1TuYVuk8Vb
|
instance isFilteredOrEmpty_op_of_isCofilteredOrEmpty [IsCofilteredOrEmpty C] :
IsFilteredOrEmpty Cᵒᵖ where
cocone_objs X Y
|
Mathlib_CategoryTheory_Filtered_Basic
|
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofilteredOrEmpty C
X Y : Cᵒᵖ
f g : X ⟶ Y
⊢ g = g.unop.op
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
symm
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image,
PSigma.mk.injEq, true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_cofiltered.cone_nonempty CategoryTheory.IsCofiltered.cone_nonempty
/-- An arbitrary choice of cone over `F : J ⥤ C`, for `FinCategory J` and `IsCofiltered C`.
-/
noncomputable def cone (F : J ⥤ C) : Cone F :=
(cone_nonempty F).some
#align category_theory.is_cofiltered.cone CategoryTheory.IsCofiltered.cone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofiltered D :=
{ IsCofilteredOrEmpty.of_left_adjoint h with
nonempty := IsCofiltered.nonempty.map L.obj }
#align category_theory.is_cofiltered.of_left_adjoint CategoryTheory.IsCofiltered.of_left_adjoint
/-- If `C` is cofiltered, and we have a left adjoint functor `L : C ⥤ D`, then `D` is cofiltered. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofiltered D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
#align category_theory.is_cofiltered.of_is_left_adjoint CategoryTheory.IsCofiltered.of_isLeftAdjoint
/-- Being cofiltered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofiltered D :=
of_left_adjoint h.toAdjunction
#align category_theory.is_cofiltered.of_equivalence CategoryTheory.IsCofiltered.of_equivalence
end Nonempty
end IsCofiltered
section Opposite
open Opposite
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y :=
⟨op (IsFiltered.max X.unop Y.unop), (IsFiltered.leftToMax _ _).op,
(IsFiltered.rightToMax _ _).op, trivial⟩
cone_maps X Y f g :=
⟨op (IsFiltered.coeq f.unop g.unop), (IsFiltered.coeqHom _ _).op, by
rw [show f = f.unop.op by simp, show g = g.unop.op by simp, ← op_comp, ← op_comp]
congr 1
exact IsFiltered.coeq_condition f.unop g.unop⟩
instance isCofiltered_op_of_isFiltered [IsFiltered C] : IsCofiltered Cᵒᵖ where
nonempty := letI : Nonempty C := IsFiltered.nonempty; inferInstance
#align category_theory.is_cofiltered_op_of_is_filtered CategoryTheory.isCofiltered_op_of_isFiltered
instance isFilteredOrEmpty_op_of_isCofilteredOrEmpty [IsCofilteredOrEmpty C] :
IsFilteredOrEmpty Cᵒᵖ where
cocone_objs X Y :=
⟨op (IsCofiltered.min X.unop Y.unop), (IsCofiltered.minToLeft X.unop Y.unop).op,
(IsCofiltered.minToRight X.unop Y.unop).op, trivial⟩
cocone_maps X Y f g :=
⟨op (IsCofiltered.eq f.unop g.unop), (IsCofiltered.eqHom f.unop g.unop).op, by
rw [show f = f.unop.op by simp, show g = g.unop.op by
|
simp
|
instance isFilteredOrEmpty_op_of_isCofilteredOrEmpty [IsCofilteredOrEmpty C] :
IsFilteredOrEmpty Cᵒᵖ where
cocone_objs X Y :=
⟨op (IsCofiltered.min X.unop Y.unop), (IsCofiltered.minToLeft X.unop Y.unop).op,
(IsCofiltered.minToRight X.unop Y.unop).op, trivial⟩
cocone_maps X Y f g :=
⟨op (IsCofiltered.eq f.unop g.unop), (IsCofiltered.eqHom f.unop g.unop).op, by
rw [show f = f.unop.op by simp, show g = g.unop.op by
|
Mathlib.CategoryTheory.Filtered.Basic.825_0.dhnXC1TuYVuk8Vb
|
instance isFilteredOrEmpty_op_of_isCofilteredOrEmpty [IsCofilteredOrEmpty C] :
IsFilteredOrEmpty Cᵒᵖ where
cocone_objs X Y
|
Mathlib_CategoryTheory_Filtered_Basic
|
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofilteredOrEmpty C
X Y : Cᵒᵖ
f g : X ⟶ Y
⊢ (IsCofiltered.eqHom f.unop.op.unop g.unop.op.unop ≫ f.unop).op =
(IsCofiltered.eqHom f.unop.op.unop g.unop.op.unop ≫ g.unop).op
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
symm
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image,
PSigma.mk.injEq, true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_cofiltered.cone_nonempty CategoryTheory.IsCofiltered.cone_nonempty
/-- An arbitrary choice of cone over `F : J ⥤ C`, for `FinCategory J` and `IsCofiltered C`.
-/
noncomputable def cone (F : J ⥤ C) : Cone F :=
(cone_nonempty F).some
#align category_theory.is_cofiltered.cone CategoryTheory.IsCofiltered.cone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofiltered D :=
{ IsCofilteredOrEmpty.of_left_adjoint h with
nonempty := IsCofiltered.nonempty.map L.obj }
#align category_theory.is_cofiltered.of_left_adjoint CategoryTheory.IsCofiltered.of_left_adjoint
/-- If `C` is cofiltered, and we have a left adjoint functor `L : C ⥤ D`, then `D` is cofiltered. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofiltered D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
#align category_theory.is_cofiltered.of_is_left_adjoint CategoryTheory.IsCofiltered.of_isLeftAdjoint
/-- Being cofiltered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofiltered D :=
of_left_adjoint h.toAdjunction
#align category_theory.is_cofiltered.of_equivalence CategoryTheory.IsCofiltered.of_equivalence
end Nonempty
end IsCofiltered
section Opposite
open Opposite
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y :=
⟨op (IsFiltered.max X.unop Y.unop), (IsFiltered.leftToMax _ _).op,
(IsFiltered.rightToMax _ _).op, trivial⟩
cone_maps X Y f g :=
⟨op (IsFiltered.coeq f.unop g.unop), (IsFiltered.coeqHom _ _).op, by
rw [show f = f.unop.op by simp, show g = g.unop.op by simp, ← op_comp, ← op_comp]
congr 1
exact IsFiltered.coeq_condition f.unop g.unop⟩
instance isCofiltered_op_of_isFiltered [IsFiltered C] : IsCofiltered Cᵒᵖ where
nonempty := letI : Nonempty C := IsFiltered.nonempty; inferInstance
#align category_theory.is_cofiltered_op_of_is_filtered CategoryTheory.isCofiltered_op_of_isFiltered
instance isFilteredOrEmpty_op_of_isCofilteredOrEmpty [IsCofilteredOrEmpty C] :
IsFilteredOrEmpty Cᵒᵖ where
cocone_objs X Y :=
⟨op (IsCofiltered.min X.unop Y.unop), (IsCofiltered.minToLeft X.unop Y.unop).op,
(IsCofiltered.minToRight X.unop Y.unop).op, trivial⟩
cocone_maps X Y f g :=
⟨op (IsCofiltered.eq f.unop g.unop), (IsCofiltered.eqHom f.unop g.unop).op, by
rw [show f = f.unop.op by simp, show g = g.unop.op by simp, ← op_comp, ← op_comp]
|
congr 1
|
instance isFilteredOrEmpty_op_of_isCofilteredOrEmpty [IsCofilteredOrEmpty C] :
IsFilteredOrEmpty Cᵒᵖ where
cocone_objs X Y :=
⟨op (IsCofiltered.min X.unop Y.unop), (IsCofiltered.minToLeft X.unop Y.unop).op,
(IsCofiltered.minToRight X.unop Y.unop).op, trivial⟩
cocone_maps X Y f g :=
⟨op (IsCofiltered.eq f.unop g.unop), (IsCofiltered.eqHom f.unop g.unop).op, by
rw [show f = f.unop.op by simp, show g = g.unop.op by simp, ← op_comp, ← op_comp]
|
Mathlib.CategoryTheory.Filtered.Basic.825_0.dhnXC1TuYVuk8Vb
|
instance isFilteredOrEmpty_op_of_isCofilteredOrEmpty [IsCofilteredOrEmpty C] :
IsFilteredOrEmpty Cᵒᵖ where
cocone_objs X Y
|
Mathlib_CategoryTheory_Filtered_Basic
|
case e_f
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofilteredOrEmpty C
X Y : Cᵒᵖ
f g : X ⟶ Y
⊢ IsCofiltered.eqHom f.unop.op.unop g.unop.op.unop ≫ f.unop = IsCofiltered.eqHom f.unop.op.unop g.unop.op.unop ≫ g.unop
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
-/
import Mathlib.CategoryTheory.FinCategory
import Mathlib.CategoryTheory.Limits.Cones
import Mathlib.CategoryTheory.Adjunction.Basic
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Category.ULift
#align_import category_theory.filtered from "leanprover-community/mathlib"@"14e80e85cbca5872a329fbfd3d1f3fd64e306934"
/-!
# Filtered categories
A category is filtered if every finite diagram admits a cocone.
We give a simple characterisation of this condition as
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
Filtered colimits are often better behaved than arbitrary colimits.
See `CategoryTheory/Limits/Types` for some details.
Filtered categories are nice because colimits indexed by filtered categories tend to be
easier to describe than general colimits (and more often preserved by functors).
In this file we show that any functor from a finite category to a filtered category admits a cocone:
* `cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F)`
More generally,
for any finite collection of objects and morphisms between them in a filtered category
(even if not closed under composition) there exists some object `Z` receiving maps from all of them,
so that all the triangles (one edge from the finite set, two from morphisms to `Z`) commute.
This formulation is often more useful in practice and is available via `sup_exists`,
which takes a finset of objects, and an indexed family (indexed by source and target)
of finsets of morphisms.
Furthermore, we give special support for two diagram categories: The `bowtie` and the `tulip`.
This is because these shapes show up in the proofs that forgetful functors of algebraic categories
(e.g. `MonCat`, `CommRingCat`, ...) preserve filtered colimits.
All of the above API, except for the `bowtie` and the `tulip`, is also provided for cofiltered
categories.
## See also
In `CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit` we show that filtered colimits
commute with finite limits.
-/
open Function
-- declare the `v`'s first; see `CategoryTheory.Category` for an explanation
universe w v v₁ u u₁ u₂
namespace CategoryTheory
variable (C : Type u) [Category.{v} C]
/-- A category `IsFilteredOrEmpty` if
1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal.
-/
class IsFilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the right" -/
cocone_objs : ∀ X Y : C, ∃ (Z : _) (_ : X ⟶ Z) (_ : Y ⟶ Z), True
/-- for every pair of parallel morphisms there exists a morphism to the right
so the compositions are equal -/
cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h
#align category_theory.is_filtered_or_empty CategoryTheory.IsFilteredOrEmpty
/-- A category `IsFiltered` if
1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/002V>. (They also define a diagram being filtered.)
-/
class IsFiltered extends IsFilteredOrEmpty C : Prop where
/-- a filtered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_filtered CategoryTheory.IsFiltered
instance (priority := 100) isFilteredOrEmpty_of_semilatticeSup (α : Type u) [SemilatticeSup α] :
IsFilteredOrEmpty α
where
cocone_objs X Y := ⟨X ⊔ Y, homOfLE le_sup_left, homOfLE le_sup_right, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_semilattice_sup CategoryTheory.isFilteredOrEmpty_of_semilatticeSup
instance (priority := 100) isFiltered_of_semilatticeSup_nonempty (α : Type u) [SemilatticeSup α]
[Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_semilattice_sup_nonempty CategoryTheory.isFiltered_of_semilatticeSup_nonempty
instance (priority := 100) isFilteredOrEmpty_of_directed_le (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] : IsFilteredOrEmpty α where
cocone_objs X Y :=
let ⟨Z, h1, h2⟩ := exists_ge_ge X Y
⟨Z, homOfLE h1, homOfLE h2, trivial⟩
cocone_maps X Y f g := ⟨Y, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_filtered_or_empty_of_directed_le CategoryTheory.isFilteredOrEmpty_of_directed_le
instance (priority := 100) isFiltered_of_directed_le_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≤ ·)] [Nonempty α] : IsFiltered α where
#align category_theory.is_filtered_of_directed_le_nonempty CategoryTheory.isFiltered_of_directed_le_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeSup α] [OrderBot α] : IsFiltered α := by infer_instance
example (α : Type u) [SemilatticeSup α] [OrderTop α] : IsFiltered α := by infer_instance
instance : IsFiltered (Discrete PUnit) where
cocone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cocone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsFiltered
section AllowEmpty
variable {C}
variable [IsFilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsFilteredOrEmpty` have been added instead
--
-- theorem cocone_objs : ∀ X Y : C, ∃ (Z : _) (f : X ⟶ Z) (g : Y ⟶ Z), True :=
-- IsFilteredOrEmpty.cocone_objs
-- #align category_theory.is_filtered.cocone_objs CategoryTheory.IsFiltered.cocone_objs
--
--theorem cocone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (Z : _) (h : Y ⟶ Z), f ≫ h = g ≫ h :=
-- IsFilteredOrEmpty.cocone_maps
--#align category_theory.is_filtered.cocone_maps CategoryTheory.IsFiltered.cocone_maps
/-- `max j j'` is an arbitrary choice of object to the right of both `j` and `j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max (j j' : C) : C :=
(IsFilteredOrEmpty.cocone_objs j j').choose
#align category_theory.is_filtered.max CategoryTheory.IsFiltered.max
/-- `leftToMax j j'` is an arbitrary choice of morphism from `j` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def leftToMax (j j' : C) : j ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose
#align category_theory.is_filtered.left_to_max CategoryTheory.IsFiltered.leftToMax
/-- `rightToMax j j'` is an arbitrary choice of morphism from `j'` to `max j j'`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def rightToMax (j j' : C) : j' ⟶ max j j' :=
(IsFilteredOrEmpty.cocone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_filtered.right_to_max CategoryTheory.IsFiltered.rightToMax
/-- `coeq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq {j j' : C} (f f' : j ⟶ j') : C :=
(IsFilteredOrEmpty.cocone_maps f f').choose
#align category_theory.is_filtered.coeq CategoryTheory.IsFiltered.coeq
/-- `coeqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`coeqHom f f' : j' ⟶ coeq f f'` such that
`coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeqHom {j j' : C} (f f' : j ⟶ j') : j' ⟶ coeq f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose
#align category_theory.is_filtered.coeq_hom CategoryTheory.IsFiltered.coeqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `coeq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`f ≫ coeqHom f f' = f' ≫ coeqHom f f'`.
-/
@[reassoc]
theorem coeq_condition {j j' : C} (f f' : j ⟶ j') : f ≫ coeqHom f f' = f' ≫ coeqHom f f' :=
(IsFilteredOrEmpty.cocone_maps f f').choose_spec.choose_spec
#align category_theory.is_filtered.coeq_condition CategoryTheory.IsFiltered.coeq_condition
end AllowEmpty
end IsFiltered
namespace IsFilteredOrEmpty
open IsFiltered
variable {C}
variable [IsFilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered or emtpy, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is
filtered or empty.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFilteredOrEmpty D :=
{ cocone_objs := fun X Y =>
⟨_, h.homEquiv _ _ (leftToMax _ _), h.homEquiv _ _ (rightToMax _ _), ⟨⟩⟩
cocone_maps := fun X Y f g =>
⟨_, h.homEquiv _ _ (coeqHom _ _), by
rw [← h.homEquiv_naturality_left, ← h.homEquiv_naturality_left, coeq_condition]⟩ }
/-- If `C` is filtered or empty, and we have a right adjoint functor `R : C ⥤ D`, then `D` is
filtered or empty. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFilteredOrEmpty D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
/-- Being filtered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFilteredOrEmpty D :=
of_right_adjoint h.symm.toAdjunction
end IsFilteredOrEmpty
namespace IsFiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsFiltered C]
/-- Any finite collection of objects in a filtered category has an object "to the right".
-/
theorem sup_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (X ⟶ S) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsFiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use max X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨leftToMax _ _⟩
· exact ⟨(w' (Finset.mem_of_mem_insert_of_ne mY h)).some ≫ rightToMax _ _⟩
#align category_theory.is_filtered.sup_objs_exists CategoryTheory.IsFiltered.sup_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : X ⟶ S` from each `X`,
such that the triangles commute: `f ≫ T Y = T X`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem sup_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (X ⟶ S)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
f ≫ T mY = T mX := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := sup_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨coeq (f ≫ T' mY) (T' mX), fun mZ => T' mZ ≫ coeqHom (f ≫ T' mY) (T' mX), _⟩
intro X' Y' mX' mY' f' mf'
rw [← Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply coeq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_filtered.sup_exists CategoryTheory.IsFiltered.sup_exists
/-- An arbitrary choice of object "to the right"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def sup : C :=
(sup_exists O H).choose
#align category_theory.is_filtered.sup CategoryTheory.IsFiltered.sup
/-- The morphisms to `sup O H`.
-/
noncomputable def toSup {X : C} (m : X ∈ O) : X ⟶ sup O H :=
(sup_exists O H).choose_spec.choose m
#align category_theory.is_filtered.to_sup CategoryTheory.IsFiltered.toSup
/-- The triangles of consisting of a morphism in `H` and the maps to `sup O H` commute.
-/
theorem toSup_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
f ≫ toSup O H mY = toSup O H mX :=
(sup_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_filtered.to_sup_commutes CategoryTheory.IsFiltered.toSup_commutes
variable {J : Type v} [SmallCategory J] [FinCategory J]
/-- If we have `IsFiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cocone over `F`.
-/
theorem cocone_nonempty (F : J ⥤ C) : Nonempty (Cocone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := sup_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.comp_id]
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image, PSigma.mk.injEq,
true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_filtered.cocone_nonempty CategoryTheory.IsFiltered.cocone_nonempty
/-- An arbitrary choice of cocone over `F : J ⥤ C`, for `FinCategory J` and `IsFiltered C`.
-/
noncomputable def cocone (F : J ⥤ C) : Cocone F :=
(cocone_nonempty F).some
#align category_theory.is_filtered.cocone CategoryTheory.IsFiltered.cocone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is filtered, and we have a functor `R : C ⥤ D` with a left adjoint, then `D` is filtered.
-/
theorem of_right_adjoint {L : D ⥤ C} {R : C ⥤ D} (h : L ⊣ R) : IsFiltered D :=
{ IsFilteredOrEmpty.of_right_adjoint h with
nonempty := IsFiltered.nonempty.map R.obj }
#align category_theory.is_filtered.of_right_adjoint CategoryTheory.IsFiltered.of_right_adjoint
/-- If `C` is filtered, and we have a right adjoint functor `R : C ⥤ D`, then `D` is filtered. -/
theorem of_isRightAdjoint (R : C ⥤ D) [IsRightAdjoint R] : IsFiltered D :=
of_right_adjoint (Adjunction.ofRightAdjoint R)
#align category_theory.is_filtered.of_is_right_adjoint CategoryTheory.IsFiltered.of_isRightAdjoint
/-- Being filtered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsFiltered D :=
of_right_adjoint h.symm.toAdjunction
#align category_theory.is_filtered.of_equivalence CategoryTheory.IsFiltered.of_equivalence
end Nonempty
section SpecialShapes
variable {C}
variable [IsFilteredOrEmpty C]
/-- `max₃ j₁ j₂ j₃` is an arbitrary choice of object to the right of `j₁`, `j₂` and `j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def max₃ (j₁ j₂ j₃ : C) : C :=
max (max j₁ j₂) j₃
#align category_theory.is_filtered.max₃ CategoryTheory.IsFiltered.max₃
/-- `firstToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₁` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def firstToMax₃ (j₁ j₂ j₃ : C) : j₁ ⟶ max₃ j₁ j₂ j₃ :=
leftToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.first_to_max₃ CategoryTheory.IsFiltered.firstToMax₃
/-- `secondToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₂` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def secondToMax₃ (j₁ j₂ j₃ : C) : j₂ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax j₁ j₂ ≫ leftToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.second_to_max₃ CategoryTheory.IsFiltered.secondToMax₃
/-- `thirdToMax₃ j₁ j₂ j₃` is an arbitrary choice of morphism from `j₃` to `max₃ j₁ j₂ j₃`,
whose existence is ensured by `IsFiltered`.
-/
noncomputable def thirdToMax₃ (j₁ j₂ j₃ : C) : j₃ ⟶ max₃ j₁ j₂ j₃ :=
rightToMax (max j₁ j₂) j₃
#align category_theory.is_filtered.third_to_max₃ CategoryTheory.IsFiltered.thirdToMax₃
/-- `coeq₃ f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of object
which admits a morphism `coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h` such that
`coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃` are satisfied.
Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : C :=
coeq (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃ CategoryTheory.IsFiltered.coeq₃
/-- `coeq₃Hom f g h`, for morphisms `f g h : j₁ ⟶ j₂`, is an arbitrary choice of morphism
`j₂ ⟶ coeq₃ f g h` such that `coeq₃_condition₁`, `coeq₃_condition₂` and `coeq₃_condition₃`
are satisfied. Its existence is ensured by `IsFiltered`.
-/
noncomputable def coeq₃Hom {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : j₂ ⟶ coeq₃ f g h :=
coeqHom f g ≫
leftToMax (coeq f g) (coeq g h) ≫
coeqHom (coeqHom f g ≫ leftToMax (coeq f g) (coeq g h))
(coeqHom g h ≫ rightToMax (coeq f g) (coeq g h))
#align category_theory.is_filtered.coeq₃_hom CategoryTheory.IsFiltered.coeq₃Hom
theorem coeq₃_condition₁ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = g ≫ coeq₃Hom f g h :=
by simp only [coeq₃Hom, ← Category.assoc, coeq_condition f g]
#align category_theory.is_filtered.coeq₃_condition₁ CategoryTheory.IsFiltered.coeq₃_condition₁
theorem coeq₃_condition₂ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) :
g ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h := by
dsimp [coeq₃Hom]
slice_lhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_rhs 2 4 => rw [← Category.assoc, coeq_condition _ _]
slice_lhs 1 3 => rw [← Category.assoc, coeq_condition _ _]
simp only [Category.assoc]
#align category_theory.is_filtered.coeq₃_condition₂ CategoryTheory.IsFiltered.coeq₃_condition₂
theorem coeq₃_condition₃ {j₁ j₂ : C} (f g h : j₁ ⟶ j₂) : f ≫ coeq₃Hom f g h = h ≫ coeq₃Hom f g h :=
Eq.trans (coeq₃_condition₁ f g h) (coeq₃_condition₂ f g h)
#align category_theory.is_filtered.coeq₃_condition₃ CategoryTheory.IsFiltered.coeq₃_condition₃
/-- For every span `j ⟵ i ⟶ j'`, there
exists a cocone `j ⟶ k ⟵ j'` such that the square commutes. -/
theorem span {i j j' : C} (f : i ⟶ j) (f' : i ⟶ j') :
∃ (k : C) (g : j ⟶ k) (g' : j' ⟶ k), f ≫ g = f' ≫ g' :=
let ⟨K, G, G', _⟩ := IsFilteredOrEmpty.cocone_objs j j'
let ⟨k, e, he⟩ := IsFilteredOrEmpty.cocone_maps (f ≫ G) (f' ≫ G')
⟨k, G ≫ e, G' ≫ e, by simpa only [← Category.assoc] ⟩
#align category_theory.is_filtered.span CategoryTheory.IsFiltered.span
/-- Given a "bowtie" of morphisms
```
j₁ j₂
|\ /|
| \/ |
| /\ |
|/ \∣
vv vv
k₁ k₂
```
in a filtered category, we can construct an object `s` and two morphisms from `k₁` and `k₂` to `s`,
making the resulting squares commute.
-/
theorem bowtie {j₁ j₂ k₁ k₂ : C} (f₁ : j₁ ⟶ k₁) (g₁ : j₁ ⟶ k₂) (f₂ : j₂ ⟶ k₁) (g₂ : j₂ ⟶ k₂) :
∃ (s : C) (α : k₁ ⟶ s) (β : k₂ ⟶ s), f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = g₂ ≫ β := by
obtain ⟨t, k₁t, k₂t, ht⟩ := span f₁ g₁
obtain ⟨s, ts, hs⟩ := IsFilteredOrEmpty.cocone_maps (f₂ ≫ k₁t) (g₂ ≫ k₂t)
simp_rw [Category.assoc] at hs
exact ⟨s, k₁t ≫ ts, k₂t ≫ ts, by simp only [← Category.assoc, ht], hs⟩
#align category_theory.is_filtered.bowtie CategoryTheory.IsFiltered.bowtie
/-- Given a "tulip" of morphisms
```
j₁ j₂ j₃
|\ / \ / |
| \ / \ / |
| vv vv |
\ k₁ k₂ /
\ /
\ /
\ /
\ /
v v
l
```
in a filtered category, we can construct an object `s` and three morphisms from `k₁`, `k₂` and `l`
to `s`, making the resulting squares commute.
-/
theorem tulip {j₁ j₂ j₃ k₁ k₂ l : C} (f₁ : j₁ ⟶ k₁) (f₂ : j₂ ⟶ k₁) (f₃ : j₂ ⟶ k₂) (f₄ : j₃ ⟶ k₂)
(g₁ : j₁ ⟶ l) (g₂ : j₃ ⟶ l) :
∃ (s : C) (α : k₁ ⟶ s) (β : l ⟶ s) (γ : k₂ ⟶ s),
f₁ ≫ α = g₁ ≫ β ∧ f₂ ≫ α = f₃ ≫ γ ∧ f₄ ≫ γ = g₂ ≫ β := by
obtain ⟨l', k₁l, k₂l, hl⟩ := span f₂ f₃
obtain ⟨s, ls, l's, hs₁, hs₂⟩ := bowtie g₁ (f₁ ≫ k₁l) g₂ (f₄ ≫ k₂l)
refine' ⟨s, k₁l ≫ l's, ls, k₂l ≫ l's, _, by simp only [← Category.assoc, hl], _⟩ <;>
simp only [hs₁, hs₂, Category.assoc]
#align category_theory.is_filtered.tulip CategoryTheory.IsFiltered.tulip
end SpecialShapes
end IsFiltered
/-- A category `IsCofilteredOrEmpty` if
1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal.
-/
class IsCofilteredOrEmpty : Prop where
/-- for every pair of objects there exists another object "to the left" -/
cone_objs : ∀ X Y : C, ∃ (W : _) (_ : W ⟶ X) (_ : W ⟶ Y), True
/-- for every pair of parallel morphisms there exists a morphism to the left
so the compositions are equal -/
cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g
#align category_theory.is_cofiltered_or_empty CategoryTheory.IsCofilteredOrEmpty
/-- A category `IsCofiltered` if
1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions
are equal, and
3. there exists some object.
See <https://stacks.math.columbia.edu/tag/04AZ>.
-/
class IsCofiltered extends IsCofilteredOrEmpty C : Prop where
/-- a cofiltered category must be non empty -/
[nonempty : Nonempty C]
#align category_theory.is_cofiltered CategoryTheory.IsCofiltered
instance (priority := 100) isCofilteredOrEmpty_of_semilatticeInf (α : Type u) [SemilatticeInf α] :
IsCofilteredOrEmpty α where
cone_objs X Y := ⟨X ⊓ Y, homOfLE inf_le_left, homOfLE inf_le_right, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_semilattice_inf CategoryTheory.isCofilteredOrEmpty_of_semilatticeInf
instance (priority := 100) isCofiltered_of_semilatticeInf_nonempty (α : Type u) [SemilatticeInf α]
[Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_semilattice_inf_nonempty CategoryTheory.isCofiltered_of_semilatticeInf_nonempty
instance (priority := 100) isCofilteredOrEmpty_of_directed_ge (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] : IsCofilteredOrEmpty α where
cone_objs X Y :=
let ⟨Z, hX, hY⟩ := exists_le_le X Y
⟨Z, homOfLE hX, homOfLE hY, trivial⟩
cone_maps X Y f g := ⟨X, 𝟙 _, by
apply ULift.ext
apply Subsingleton.elim⟩
#align category_theory.is_cofiltered_or_empty_of_directed_ge CategoryTheory.isCofilteredOrEmpty_of_directed_ge
instance (priority := 100) isCofiltered_of_directed_ge_nonempty (α : Type u) [Preorder α]
[IsDirected α (· ≥ ·)] [Nonempty α] : IsCofiltered α where
#align category_theory.is_cofiltered_of_directed_ge_nonempty CategoryTheory.isCofiltered_of_directed_ge_nonempty
-- Sanity checks
example (α : Type u) [SemilatticeInf α] [OrderBot α] : IsCofiltered α := by infer_instance
example (α : Type u) [SemilatticeInf α] [OrderTop α] : IsCofiltered α := by infer_instance
instance : IsCofiltered (Discrete PUnit) where
cone_objs X Y := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, ⟨⟨Subsingleton.elim _ _⟩⟩, trivial⟩
cone_maps X Y f g := ⟨⟨PUnit.unit⟩, ⟨⟨by trivial⟩⟩, by
apply ULift.ext
apply Subsingleton.elim⟩
namespace IsCofiltered
section AllowEmpty
variable {C}
variable [IsCofilteredOrEmpty C]
-- porting note: the following definitions were removed because the names are invalid,
-- direct references to `IsCofilteredOrEmpty` have been added instead
--
--theorem cone_objs : ∀ X Y : C, ∃ (W : _) (f : W ⟶ X) (g : W ⟶ Y), True :=
-- IsCofilteredOrEmpty.cone_objs
--#align category_theory.is_cofiltered.cone_objs CategoryTheory.IsCofiltered.cone_objs
--
--theorem cone_maps : ∀ ⦃X Y : C⦄ (f g : X ⟶ Y), ∃ (W : _) (h : W ⟶ X), h ≫ f = h ≫ g :=
-- IsCofilteredOrEmpty.cone_maps
--#align category_theory.is_cofiltered.cone_maps CategoryTheory.IsCofiltered.cone_maps
/-- `min j j'` is an arbitrary choice of object to the left of both `j` and `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def min (j j' : C) : C :=
(IsCofilteredOrEmpty.cone_objs j j').choose
#align category_theory.is_cofiltered.min CategoryTheory.IsCofiltered.min
/-- `minToLeft j j'` is an arbitrary choice of morphism from `min j j'` to `j`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToLeft (j j' : C) : min j j' ⟶ j :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose
#align category_theory.is_cofiltered.min_to_left CategoryTheory.IsCofiltered.minToLeft
/-- `minToRight j j'` is an arbitrary choice of morphism from `min j j'` to `j'`,
whose existence is ensured by `IsCofiltered`.
-/
noncomputable def minToRight (j j' : C) : min j j' ⟶ j' :=
(IsCofilteredOrEmpty.cone_objs j j').choose_spec.choose_spec.choose
#align category_theory.is_cofiltered.min_to_right CategoryTheory.IsCofiltered.minToRight
/-- `eq f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of object
which admits a morphism `eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eq {j j' : C} (f f' : j ⟶ j') : C :=
(IsCofilteredOrEmpty.cone_maps f f').choose
#align category_theory.is_cofiltered.eq CategoryTheory.IsCofiltered.eq
/-- `eqHom f f'`, for morphisms `f f' : j ⟶ j'`, is an arbitrary choice of morphism
`eqHom f f' : eq f f' ⟶ j` such that
`eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'`.
Its existence is ensured by `IsCofiltered`.
-/
noncomputable def eqHom {j j' : C} (f f' : j ⟶ j') : eq f f' ⟶ j :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose
#align category_theory.is_cofiltered.eq_hom CategoryTheory.IsCofiltered.eqHom
-- porting note: the simp tag has been removed as the linter complained
/-- `eq_condition f f'`, for morphisms `f f' : j ⟶ j'`, is the proof that
`eqHom f f' ≫ f = eqHom f f' ≫ f'`.
-/
@[reassoc]
theorem eq_condition {j j' : C} (f f' : j ⟶ j') : eqHom f f' ≫ f = eqHom f f' ≫ f' :=
(IsCofilteredOrEmpty.cone_maps f f').choose_spec.choose_spec
#align category_theory.is_cofiltered.eq_condition CategoryTheory.IsCofiltered.eq_condition
/-- For every cospan `j ⟶ i ⟵ j'`,
there exists a cone `j ⟵ k ⟶ j'` such that the square commutes. -/
theorem cospan {i j j' : C} (f : j ⟶ i) (f' : j' ⟶ i) :
∃ (k : C) (g : k ⟶ j) (g' : k ⟶ j'), g ≫ f = g' ≫ f' :=
let ⟨K, G, G', _⟩ := IsCofilteredOrEmpty.cone_objs j j'
let ⟨k, e, he⟩ := IsCofilteredOrEmpty.cone_maps (G ≫ f) (G' ≫ f')
⟨k, e ≫ G, e ≫ G', by simpa only [Category.assoc] using he⟩
#align category_theory.is_cofiltered.cospan CategoryTheory.IsCofiltered.cospan
theorem _root_.CategoryTheory.Functor.ranges_directed (F : C ⥤ Type*) (j : C) :
Directed (· ⊇ ·) fun f : Σ'i, i ⟶ j => Set.range (F.map f.2) := fun ⟨i, ij⟩ ⟨k, kj⟩ => by
let ⟨l, li, lk, e⟩ := cospan ij kj
refine' ⟨⟨l, lk ≫ kj⟩, e ▸ _, _⟩ <;> simp_rw [F.map_comp] <;> apply Set.range_comp_subset_range
#align category_theory.functor.ranges_directed CategoryTheory.Functor.ranges_directed
end AllowEmpty
end IsCofiltered
namespace IsCofilteredOrEmpty
open IsCofiltered
variable {C}
variable [IsCofilteredOrEmpty C]
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered or empty, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered or empty.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofilteredOrEmpty D :=
{ cone_objs := fun X Y =>
⟨L.obj (min (R.obj X) (R.obj Y)), (h.homEquiv _ X).symm (minToLeft _ _),
(h.homEquiv _ Y).symm (minToRight _ _), ⟨⟩⟩
cone_maps := fun X Y f g =>
⟨L.obj (eq (R.map f) (R.map g)), (h.homEquiv _ _).symm (eqHom _ _), by
rw [← h.homEquiv_naturality_right_symm, ← h.homEquiv_naturality_right_symm, eq_condition]⟩ }
/-- If `C` is cofiltered or empty, and we have a left adjoint functor `L : C ⥤ D`, then `D` is
cofiltered or empty. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofilteredOrEmpty D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
/-- Being cofiltered or empty is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofilteredOrEmpty D :=
of_left_adjoint h.toAdjunction
end IsCofilteredOrEmpty
namespace IsCofiltered
section Nonempty
open CategoryTheory.Limits
variable {C}
variable [IsCofiltered C]
/-- Any finite collection of objects in a cofiltered category has an object "to the left".
-/
theorem inf_objs_exists (O : Finset C) : ∃ S : C, ∀ {X}, X ∈ O → Nonempty (S ⟶ X) := by
classical
induction' O using Finset.induction with X O' nm h
· exact ⟨Classical.choice IsCofiltered.nonempty, by intro; simp⟩
· obtain ⟨S', w'⟩ := h
use min X S'
rintro Y mY
obtain rfl | h := eq_or_ne Y X
· exact ⟨minToLeft _ _⟩
· exact ⟨minToRight _ _ ≫ (w' (Finset.mem_of_mem_insert_of_ne mY h)).some⟩
#align category_theory.is_cofiltered.inf_objs_exists CategoryTheory.IsCofiltered.inf_objs_exists
variable (O : Finset C) (H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y))
/-- Given any `Finset` of objects `{X, ...}` and
indexed collection of `Finset`s of morphisms `{f, ...}` in `C`,
there exists an object `S`, with a morphism `T X : S ⟶ X` from each `X`,
such that the triangles commute: `T X ≫ f = T Y`, for `f : X ⟶ Y` in the `Finset`.
-/
theorem inf_exists :
∃ (S : C) (T : ∀ {X : C}, X ∈ O → (S ⟶ X)),
∀ {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y},
(⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H →
T mX ≫ f = T mY := by
classical
induction' H using Finset.induction with h' H' nmf h''
· obtain ⟨S, f⟩ := inf_objs_exists O
refine' ⟨S, fun mX => (f mX).some, by rintro - - - - - ⟨⟩⟩
· obtain ⟨X, Y, mX, mY, f⟩ := h'
obtain ⟨S', T', w'⟩ := h''
refine' ⟨eq (T' mX ≫ f) (T' mY), fun mZ => eqHom (T' mX ≫ f) (T' mY) ≫ T' mZ, _⟩
intro X' Y' mX' mY' f' mf'
rw [Category.assoc]
by_cases h : X = X' ∧ Y = Y'
· rcases h with ⟨rfl, rfl⟩
by_cases hf : f = f'
· subst hf
apply eq_condition
· rw [@w' _ _ mX mY f']
simp only [Finset.mem_insert, PSigma.mk.injEq, heq_eq_eq, true_and] at mf'
rcases mf' with mf' | mf'
· exfalso
exact hf mf'.symm
· exact mf'
· rw [@w' _ _ mX' mY' f' _]
apply Finset.mem_of_mem_insert_of_ne mf'
contrapose! h
obtain ⟨rfl, h⟩ := h
trivial
#align category_theory.is_cofiltered.inf_exists CategoryTheory.IsCofiltered.inf_exists
/-- An arbitrary choice of object "to the left"
of a finite collection of objects `O` and morphisms `H`,
making all the triangles commute.
-/
noncomputable def inf : C :=
(inf_exists O H).choose
#align category_theory.is_cofiltered.inf CategoryTheory.IsCofiltered.inf
/-- The morphisms from `inf O H`.
-/
noncomputable def infTo {X : C} (m : X ∈ O) : inf O H ⟶ X :=
(inf_exists O H).choose_spec.choose m
#align category_theory.is_cofiltered.inf_to CategoryTheory.IsCofiltered.infTo
/-- The triangles consisting of a morphism in `H` and the maps from `inf O H` commute.
-/
theorem infTo_commutes {X Y : C} (mX : X ∈ O) (mY : Y ∈ O) {f : X ⟶ Y}
(mf : (⟨X, Y, mX, mY, f⟩ : Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) ∈ H) :
infTo O H mX ≫ f = infTo O H mY :=
(inf_exists O H).choose_spec.choose_spec mX mY mf
#align category_theory.is_cofiltered.inf_to_commutes CategoryTheory.IsCofiltered.infTo_commutes
variable {J : Type w} [SmallCategory J] [FinCategory J]
/-- If we have `IsCofiltered C`, then for any functor `F : J ⥤ C` with `FinCategory J`,
there exists a cone over `F`.
-/
theorem cone_nonempty (F : J ⥤ C) : Nonempty (Cone F) := by
classical
let O := Finset.univ.image F.obj
let H : Finset (Σ' (X Y : C) (_ : X ∈ O) (_ : Y ∈ O), X ⟶ Y) :=
Finset.univ.biUnion fun X : J =>
Finset.univ.biUnion fun Y : J =>
Finset.univ.image fun f : X ⟶ Y => ⟨F.obj X, F.obj Y, by simp, by simp, F.map f⟩
obtain ⟨Z, f, w⟩ := inf_exists O H
refine' ⟨⟨Z, ⟨fun X => f (by simp), _⟩⟩⟩
intro j j' g
dsimp
simp only [Category.id_comp]
symm
apply w
simp only [Finset.mem_biUnion, Finset.mem_univ, Finset.mem_image,
PSigma.mk.injEq, true_and, exists_and_left]
exact ⟨j, rfl, j', g, by simp⟩
#align category_theory.is_cofiltered.cone_nonempty CategoryTheory.IsCofiltered.cone_nonempty
/-- An arbitrary choice of cone over `F : J ⥤ C`, for `FinCategory J` and `IsCofiltered C`.
-/
noncomputable def cone (F : J ⥤ C) : Cone F :=
(cone_nonempty F).some
#align category_theory.is_cofiltered.cone CategoryTheory.IsCofiltered.cone
variable {D : Type u₁} [Category.{v₁} D]
/-- If `C` is cofiltered, and we have a functor `L : C ⥤ D` with a right adjoint,
then `D` is cofiltered.
-/
theorem of_left_adjoint {L : C ⥤ D} {R : D ⥤ C} (h : L ⊣ R) : IsCofiltered D :=
{ IsCofilteredOrEmpty.of_left_adjoint h with
nonempty := IsCofiltered.nonempty.map L.obj }
#align category_theory.is_cofiltered.of_left_adjoint CategoryTheory.IsCofiltered.of_left_adjoint
/-- If `C` is cofiltered, and we have a left adjoint functor `L : C ⥤ D`, then `D` is cofiltered. -/
theorem of_isLeftAdjoint (L : C ⥤ D) [IsLeftAdjoint L] : IsCofiltered D :=
of_left_adjoint (Adjunction.ofLeftAdjoint L)
#align category_theory.is_cofiltered.of_is_left_adjoint CategoryTheory.IsCofiltered.of_isLeftAdjoint
/-- Being cofiltered is preserved by equivalence of categories. -/
theorem of_equivalence (h : C ≌ D) : IsCofiltered D :=
of_left_adjoint h.toAdjunction
#align category_theory.is_cofiltered.of_equivalence CategoryTheory.IsCofiltered.of_equivalence
end Nonempty
end IsCofiltered
section Opposite
open Opposite
instance isCofilteredOrEmpty_op_of_isFilteredOrEmpty [IsFilteredOrEmpty C] :
IsCofilteredOrEmpty Cᵒᵖ where
cone_objs X Y :=
⟨op (IsFiltered.max X.unop Y.unop), (IsFiltered.leftToMax _ _).op,
(IsFiltered.rightToMax _ _).op, trivial⟩
cone_maps X Y f g :=
⟨op (IsFiltered.coeq f.unop g.unop), (IsFiltered.coeqHom _ _).op, by
rw [show f = f.unop.op by simp, show g = g.unop.op by simp, ← op_comp, ← op_comp]
congr 1
exact IsFiltered.coeq_condition f.unop g.unop⟩
instance isCofiltered_op_of_isFiltered [IsFiltered C] : IsCofiltered Cᵒᵖ where
nonempty := letI : Nonempty C := IsFiltered.nonempty; inferInstance
#align category_theory.is_cofiltered_op_of_is_filtered CategoryTheory.isCofiltered_op_of_isFiltered
instance isFilteredOrEmpty_op_of_isCofilteredOrEmpty [IsCofilteredOrEmpty C] :
IsFilteredOrEmpty Cᵒᵖ where
cocone_objs X Y :=
⟨op (IsCofiltered.min X.unop Y.unop), (IsCofiltered.minToLeft X.unop Y.unop).op,
(IsCofiltered.minToRight X.unop Y.unop).op, trivial⟩
cocone_maps X Y f g :=
⟨op (IsCofiltered.eq f.unop g.unop), (IsCofiltered.eqHom f.unop g.unop).op, by
rw [show f = f.unop.op by simp, show g = g.unop.op by simp, ← op_comp, ← op_comp]
congr 1
|
exact IsCofiltered.eq_condition f.unop g.unop
|
instance isFilteredOrEmpty_op_of_isCofilteredOrEmpty [IsCofilteredOrEmpty C] :
IsFilteredOrEmpty Cᵒᵖ where
cocone_objs X Y :=
⟨op (IsCofiltered.min X.unop Y.unop), (IsCofiltered.minToLeft X.unop Y.unop).op,
(IsCofiltered.minToRight X.unop Y.unop).op, trivial⟩
cocone_maps X Y f g :=
⟨op (IsCofiltered.eq f.unop g.unop), (IsCofiltered.eqHom f.unop g.unop).op, by
rw [show f = f.unop.op by simp, show g = g.unop.op by simp, ← op_comp, ← op_comp]
congr 1
|
Mathlib.CategoryTheory.Filtered.Basic.825_0.dhnXC1TuYVuk8Vb
|
instance isFilteredOrEmpty_op_of_isCofilteredOrEmpty [IsCofilteredOrEmpty C] :
IsFilteredOrEmpty Cᵒᵖ where
cocone_objs X Y
|
Mathlib_CategoryTheory_Filtered_Basic
|
n : ℕ
⊢ range (succ n) = n ::ₘ range n
|
/-
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Data.Multiset.Basic
import Mathlib.Data.List.Range
#align_import data.multiset.range from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
/-! # `Multiset.range n` gives `{0, 1, ..., n-1}` as a multiset. -/
open List Nat
namespace Multiset
-- range
/-- `range n` is the multiset lifted from the list `range n`,
that is, the set `{0, 1, ..., n-1}`. -/
def range (n : ℕ) : Multiset ℕ :=
List.range n
#align multiset.range Multiset.range
theorem coe_range (n : ℕ) : ↑(List.range n) = range n :=
rfl
#align multiset.coe_range Multiset.coe_range
@[simp]
theorem range_zero : range 0 = 0 :=
rfl
#align multiset.range_zero Multiset.range_zero
@[simp]
theorem range_succ (n : ℕ) : range (succ n) = n ::ₘ range n := by
|
rw [range, List.range_succ, ← coe_add, add_comm]
|
@[simp]
theorem range_succ (n : ℕ) : range (succ n) = n ::ₘ range n := by
|
Mathlib.Data.Multiset.Range.34_0.3IYEfNCsb0H7K9Z
|
@[simp]
theorem range_succ (n : ℕ) : range (succ n) = n ::ₘ range n
|
Mathlib_Data_Multiset_Range
|
n : ℕ
⊢ ↑[n] + ↑(List.range n) = n ::ₘ range n
|
/-
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Data.Multiset.Basic
import Mathlib.Data.List.Range
#align_import data.multiset.range from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
/-! # `Multiset.range n` gives `{0, 1, ..., n-1}` as a multiset. -/
open List Nat
namespace Multiset
-- range
/-- `range n` is the multiset lifted from the list `range n`,
that is, the set `{0, 1, ..., n-1}`. -/
def range (n : ℕ) : Multiset ℕ :=
List.range n
#align multiset.range Multiset.range
theorem coe_range (n : ℕ) : ↑(List.range n) = range n :=
rfl
#align multiset.coe_range Multiset.coe_range
@[simp]
theorem range_zero : range 0 = 0 :=
rfl
#align multiset.range_zero Multiset.range_zero
@[simp]
theorem range_succ (n : ℕ) : range (succ n) = n ::ₘ range n := by
rw [range, List.range_succ, ← coe_add, add_comm];
|
rfl
|
@[simp]
theorem range_succ (n : ℕ) : range (succ n) = n ::ₘ range n := by
rw [range, List.range_succ, ← coe_add, add_comm];
|
Mathlib.Data.Multiset.Range.34_0.3IYEfNCsb0H7K9Z
|
@[simp]
theorem range_succ (n : ℕ) : range (succ n) = n ::ₘ range n
|
Mathlib_Data_Multiset_Range
|
a : ℕ
m : Multiset ℕ
⊢ Disjoint (range a) (map (fun x => a + x) m)
|
/-
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Data.Multiset.Basic
import Mathlib.Data.List.Range
#align_import data.multiset.range from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
/-! # `Multiset.range n` gives `{0, 1, ..., n-1}` as a multiset. -/
open List Nat
namespace Multiset
-- range
/-- `range n` is the multiset lifted from the list `range n`,
that is, the set `{0, 1, ..., n-1}`. -/
def range (n : ℕ) : Multiset ℕ :=
List.range n
#align multiset.range Multiset.range
theorem coe_range (n : ℕ) : ↑(List.range n) = range n :=
rfl
#align multiset.coe_range Multiset.coe_range
@[simp]
theorem range_zero : range 0 = 0 :=
rfl
#align multiset.range_zero Multiset.range_zero
@[simp]
theorem range_succ (n : ℕ) : range (succ n) = n ::ₘ range n := by
rw [range, List.range_succ, ← coe_add, add_comm]; rfl
#align multiset.range_succ Multiset.range_succ
@[simp]
theorem card_range (n : ℕ) : card (range n) = n :=
length_range _
#align multiset.card_range Multiset.card_range
theorem range_subset {m n : ℕ} : range m ⊆ range n ↔ m ≤ n :=
List.range_subset
#align multiset.range_subset Multiset.range_subset
@[simp]
theorem mem_range {m n : ℕ} : m ∈ range n ↔ m < n :=
List.mem_range
#align multiset.mem_range Multiset.mem_range
--Porting note: removing @[simp], `simp` can prove it
theorem not_mem_range_self {n : ℕ} : n ∉ range n :=
List.not_mem_range_self
#align multiset.not_mem_range_self Multiset.not_mem_range_self
theorem self_mem_range_succ (n : ℕ) : n ∈ range (n + 1) :=
List.self_mem_range_succ n
#align multiset.self_mem_range_succ Multiset.self_mem_range_succ
theorem range_add (a b : ℕ) : range (a + b) = range a + (range b).map (a + ·) :=
congr_arg ((↑) : List ℕ → Multiset ℕ) (List.range_add _ _)
#align multiset.range_add Multiset.range_add
theorem range_disjoint_map_add (a : ℕ) (m : Multiset ℕ) :
(range a).Disjoint (m.map (a + ·)) := by
|
intro x hxa hxb
|
theorem range_disjoint_map_add (a : ℕ) (m : Multiset ℕ) :
(range a).Disjoint (m.map (a + ·)) := by
|
Mathlib.Data.Multiset.Range.66_0.3IYEfNCsb0H7K9Z
|
theorem range_disjoint_map_add (a : ℕ) (m : Multiset ℕ) :
(range a).Disjoint (m.map (a + ·))
|
Mathlib_Data_Multiset_Range
|
a : ℕ
m : Multiset ℕ
x : ℕ
hxa : x ∈ range a
hxb : x ∈ map (fun x => a + x) m
⊢ False
|
/-
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Data.Multiset.Basic
import Mathlib.Data.List.Range
#align_import data.multiset.range from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
/-! # `Multiset.range n` gives `{0, 1, ..., n-1}` as a multiset. -/
open List Nat
namespace Multiset
-- range
/-- `range n` is the multiset lifted from the list `range n`,
that is, the set `{0, 1, ..., n-1}`. -/
def range (n : ℕ) : Multiset ℕ :=
List.range n
#align multiset.range Multiset.range
theorem coe_range (n : ℕ) : ↑(List.range n) = range n :=
rfl
#align multiset.coe_range Multiset.coe_range
@[simp]
theorem range_zero : range 0 = 0 :=
rfl
#align multiset.range_zero Multiset.range_zero
@[simp]
theorem range_succ (n : ℕ) : range (succ n) = n ::ₘ range n := by
rw [range, List.range_succ, ← coe_add, add_comm]; rfl
#align multiset.range_succ Multiset.range_succ
@[simp]
theorem card_range (n : ℕ) : card (range n) = n :=
length_range _
#align multiset.card_range Multiset.card_range
theorem range_subset {m n : ℕ} : range m ⊆ range n ↔ m ≤ n :=
List.range_subset
#align multiset.range_subset Multiset.range_subset
@[simp]
theorem mem_range {m n : ℕ} : m ∈ range n ↔ m < n :=
List.mem_range
#align multiset.mem_range Multiset.mem_range
--Porting note: removing @[simp], `simp` can prove it
theorem not_mem_range_self {n : ℕ} : n ∉ range n :=
List.not_mem_range_self
#align multiset.not_mem_range_self Multiset.not_mem_range_self
theorem self_mem_range_succ (n : ℕ) : n ∈ range (n + 1) :=
List.self_mem_range_succ n
#align multiset.self_mem_range_succ Multiset.self_mem_range_succ
theorem range_add (a b : ℕ) : range (a + b) = range a + (range b).map (a + ·) :=
congr_arg ((↑) : List ℕ → Multiset ℕ) (List.range_add _ _)
#align multiset.range_add Multiset.range_add
theorem range_disjoint_map_add (a : ℕ) (m : Multiset ℕ) :
(range a).Disjoint (m.map (a + ·)) := by
intro x hxa hxb
|
rw [range, mem_coe, List.mem_range] at hxa
|
theorem range_disjoint_map_add (a : ℕ) (m : Multiset ℕ) :
(range a).Disjoint (m.map (a + ·)) := by
intro x hxa hxb
|
Mathlib.Data.Multiset.Range.66_0.3IYEfNCsb0H7K9Z
|
theorem range_disjoint_map_add (a : ℕ) (m : Multiset ℕ) :
(range a).Disjoint (m.map (a + ·))
|
Mathlib_Data_Multiset_Range
|
a : ℕ
m : Multiset ℕ
x : ℕ
hxa : x < a
hxb : x ∈ map (fun x => a + x) m
⊢ False
|
/-
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Data.Multiset.Basic
import Mathlib.Data.List.Range
#align_import data.multiset.range from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
/-! # `Multiset.range n` gives `{0, 1, ..., n-1}` as a multiset. -/
open List Nat
namespace Multiset
-- range
/-- `range n` is the multiset lifted from the list `range n`,
that is, the set `{0, 1, ..., n-1}`. -/
def range (n : ℕ) : Multiset ℕ :=
List.range n
#align multiset.range Multiset.range
theorem coe_range (n : ℕ) : ↑(List.range n) = range n :=
rfl
#align multiset.coe_range Multiset.coe_range
@[simp]
theorem range_zero : range 0 = 0 :=
rfl
#align multiset.range_zero Multiset.range_zero
@[simp]
theorem range_succ (n : ℕ) : range (succ n) = n ::ₘ range n := by
rw [range, List.range_succ, ← coe_add, add_comm]; rfl
#align multiset.range_succ Multiset.range_succ
@[simp]
theorem card_range (n : ℕ) : card (range n) = n :=
length_range _
#align multiset.card_range Multiset.card_range
theorem range_subset {m n : ℕ} : range m ⊆ range n ↔ m ≤ n :=
List.range_subset
#align multiset.range_subset Multiset.range_subset
@[simp]
theorem mem_range {m n : ℕ} : m ∈ range n ↔ m < n :=
List.mem_range
#align multiset.mem_range Multiset.mem_range
--Porting note: removing @[simp], `simp` can prove it
theorem not_mem_range_self {n : ℕ} : n ∉ range n :=
List.not_mem_range_self
#align multiset.not_mem_range_self Multiset.not_mem_range_self
theorem self_mem_range_succ (n : ℕ) : n ∈ range (n + 1) :=
List.self_mem_range_succ n
#align multiset.self_mem_range_succ Multiset.self_mem_range_succ
theorem range_add (a b : ℕ) : range (a + b) = range a + (range b).map (a + ·) :=
congr_arg ((↑) : List ℕ → Multiset ℕ) (List.range_add _ _)
#align multiset.range_add Multiset.range_add
theorem range_disjoint_map_add (a : ℕ) (m : Multiset ℕ) :
(range a).Disjoint (m.map (a + ·)) := by
intro x hxa hxb
rw [range, mem_coe, List.mem_range] at hxa
|
obtain ⟨c, _, rfl⟩ := mem_map.1 hxb
|
theorem range_disjoint_map_add (a : ℕ) (m : Multiset ℕ) :
(range a).Disjoint (m.map (a + ·)) := by
intro x hxa hxb
rw [range, mem_coe, List.mem_range] at hxa
|
Mathlib.Data.Multiset.Range.66_0.3IYEfNCsb0H7K9Z
|
theorem range_disjoint_map_add (a : ℕ) (m : Multiset ℕ) :
(range a).Disjoint (m.map (a + ·))
|
Mathlib_Data_Multiset_Range
|
case intro.intro
a : ℕ
m : Multiset ℕ
c : ℕ
left✝ : c ∈ m
hxa : a + c < a
hxb : a + c ∈ map (fun x => a + x) m
⊢ False
|
/-
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Data.Multiset.Basic
import Mathlib.Data.List.Range
#align_import data.multiset.range from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
/-! # `Multiset.range n` gives `{0, 1, ..., n-1}` as a multiset. -/
open List Nat
namespace Multiset
-- range
/-- `range n` is the multiset lifted from the list `range n`,
that is, the set `{0, 1, ..., n-1}`. -/
def range (n : ℕ) : Multiset ℕ :=
List.range n
#align multiset.range Multiset.range
theorem coe_range (n : ℕ) : ↑(List.range n) = range n :=
rfl
#align multiset.coe_range Multiset.coe_range
@[simp]
theorem range_zero : range 0 = 0 :=
rfl
#align multiset.range_zero Multiset.range_zero
@[simp]
theorem range_succ (n : ℕ) : range (succ n) = n ::ₘ range n := by
rw [range, List.range_succ, ← coe_add, add_comm]; rfl
#align multiset.range_succ Multiset.range_succ
@[simp]
theorem card_range (n : ℕ) : card (range n) = n :=
length_range _
#align multiset.card_range Multiset.card_range
theorem range_subset {m n : ℕ} : range m ⊆ range n ↔ m ≤ n :=
List.range_subset
#align multiset.range_subset Multiset.range_subset
@[simp]
theorem mem_range {m n : ℕ} : m ∈ range n ↔ m < n :=
List.mem_range
#align multiset.mem_range Multiset.mem_range
--Porting note: removing @[simp], `simp` can prove it
theorem not_mem_range_self {n : ℕ} : n ∉ range n :=
List.not_mem_range_self
#align multiset.not_mem_range_self Multiset.not_mem_range_self
theorem self_mem_range_succ (n : ℕ) : n ∈ range (n + 1) :=
List.self_mem_range_succ n
#align multiset.self_mem_range_succ Multiset.self_mem_range_succ
theorem range_add (a b : ℕ) : range (a + b) = range a + (range b).map (a + ·) :=
congr_arg ((↑) : List ℕ → Multiset ℕ) (List.range_add _ _)
#align multiset.range_add Multiset.range_add
theorem range_disjoint_map_add (a : ℕ) (m : Multiset ℕ) :
(range a).Disjoint (m.map (a + ·)) := by
intro x hxa hxb
rw [range, mem_coe, List.mem_range] at hxa
obtain ⟨c, _, rfl⟩ := mem_map.1 hxb
|
exact (self_le_add_right _ _).not_lt hxa
|
theorem range_disjoint_map_add (a : ℕ) (m : Multiset ℕ) :
(range a).Disjoint (m.map (a + ·)) := by
intro x hxa hxb
rw [range, mem_coe, List.mem_range] at hxa
obtain ⟨c, _, rfl⟩ := mem_map.1 hxb
|
Mathlib.Data.Multiset.Range.66_0.3IYEfNCsb0H7K9Z
|
theorem range_disjoint_map_add (a : ℕ) (m : Multiset ℕ) :
(range a).Disjoint (m.map (a + ·))
|
Mathlib_Data_Multiset_Range
|
a b : ℕ
⊢ range (a + b) = range a ∪ map (fun x => a + x) (range b)
|
/-
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Data.Multiset.Basic
import Mathlib.Data.List.Range
#align_import data.multiset.range from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
/-! # `Multiset.range n` gives `{0, 1, ..., n-1}` as a multiset. -/
open List Nat
namespace Multiset
-- range
/-- `range n` is the multiset lifted from the list `range n`,
that is, the set `{0, 1, ..., n-1}`. -/
def range (n : ℕ) : Multiset ℕ :=
List.range n
#align multiset.range Multiset.range
theorem coe_range (n : ℕ) : ↑(List.range n) = range n :=
rfl
#align multiset.coe_range Multiset.coe_range
@[simp]
theorem range_zero : range 0 = 0 :=
rfl
#align multiset.range_zero Multiset.range_zero
@[simp]
theorem range_succ (n : ℕ) : range (succ n) = n ::ₘ range n := by
rw [range, List.range_succ, ← coe_add, add_comm]; rfl
#align multiset.range_succ Multiset.range_succ
@[simp]
theorem card_range (n : ℕ) : card (range n) = n :=
length_range _
#align multiset.card_range Multiset.card_range
theorem range_subset {m n : ℕ} : range m ⊆ range n ↔ m ≤ n :=
List.range_subset
#align multiset.range_subset Multiset.range_subset
@[simp]
theorem mem_range {m n : ℕ} : m ∈ range n ↔ m < n :=
List.mem_range
#align multiset.mem_range Multiset.mem_range
--Porting note: removing @[simp], `simp` can prove it
theorem not_mem_range_self {n : ℕ} : n ∉ range n :=
List.not_mem_range_self
#align multiset.not_mem_range_self Multiset.not_mem_range_self
theorem self_mem_range_succ (n : ℕ) : n ∈ range (n + 1) :=
List.self_mem_range_succ n
#align multiset.self_mem_range_succ Multiset.self_mem_range_succ
theorem range_add (a b : ℕ) : range (a + b) = range a + (range b).map (a + ·) :=
congr_arg ((↑) : List ℕ → Multiset ℕ) (List.range_add _ _)
#align multiset.range_add Multiset.range_add
theorem range_disjoint_map_add (a : ℕ) (m : Multiset ℕ) :
(range a).Disjoint (m.map (a + ·)) := by
intro x hxa hxb
rw [range, mem_coe, List.mem_range] at hxa
obtain ⟨c, _, rfl⟩ := mem_map.1 hxb
exact (self_le_add_right _ _).not_lt hxa
#align multiset.range_disjoint_map_add Multiset.range_disjoint_map_add
theorem range_add_eq_union (a b : ℕ) : range (a + b) = range a ∪ (range b).map (a + ·) := by
|
rw [range_add, add_eq_union_iff_disjoint]
|
theorem range_add_eq_union (a b : ℕ) : range (a + b) = range a ∪ (range b).map (a + ·) := by
|
Mathlib.Data.Multiset.Range.74_0.3IYEfNCsb0H7K9Z
|
theorem range_add_eq_union (a b : ℕ) : range (a + b) = range a ∪ (range b).map (a + ·)
|
Mathlib_Data_Multiset_Range
|
a b : ℕ
⊢ Disjoint (range a) (map (fun x => a + x) (range b))
|
/-
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Mathlib.Data.Multiset.Basic
import Mathlib.Data.List.Range
#align_import data.multiset.range from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
/-! # `Multiset.range n` gives `{0, 1, ..., n-1}` as a multiset. -/
open List Nat
namespace Multiset
-- range
/-- `range n` is the multiset lifted from the list `range n`,
that is, the set `{0, 1, ..., n-1}`. -/
def range (n : ℕ) : Multiset ℕ :=
List.range n
#align multiset.range Multiset.range
theorem coe_range (n : ℕ) : ↑(List.range n) = range n :=
rfl
#align multiset.coe_range Multiset.coe_range
@[simp]
theorem range_zero : range 0 = 0 :=
rfl
#align multiset.range_zero Multiset.range_zero
@[simp]
theorem range_succ (n : ℕ) : range (succ n) = n ::ₘ range n := by
rw [range, List.range_succ, ← coe_add, add_comm]; rfl
#align multiset.range_succ Multiset.range_succ
@[simp]
theorem card_range (n : ℕ) : card (range n) = n :=
length_range _
#align multiset.card_range Multiset.card_range
theorem range_subset {m n : ℕ} : range m ⊆ range n ↔ m ≤ n :=
List.range_subset
#align multiset.range_subset Multiset.range_subset
@[simp]
theorem mem_range {m n : ℕ} : m ∈ range n ↔ m < n :=
List.mem_range
#align multiset.mem_range Multiset.mem_range
--Porting note: removing @[simp], `simp` can prove it
theorem not_mem_range_self {n : ℕ} : n ∉ range n :=
List.not_mem_range_self
#align multiset.not_mem_range_self Multiset.not_mem_range_self
theorem self_mem_range_succ (n : ℕ) : n ∈ range (n + 1) :=
List.self_mem_range_succ n
#align multiset.self_mem_range_succ Multiset.self_mem_range_succ
theorem range_add (a b : ℕ) : range (a + b) = range a + (range b).map (a + ·) :=
congr_arg ((↑) : List ℕ → Multiset ℕ) (List.range_add _ _)
#align multiset.range_add Multiset.range_add
theorem range_disjoint_map_add (a : ℕ) (m : Multiset ℕ) :
(range a).Disjoint (m.map (a + ·)) := by
intro x hxa hxb
rw [range, mem_coe, List.mem_range] at hxa
obtain ⟨c, _, rfl⟩ := mem_map.1 hxb
exact (self_le_add_right _ _).not_lt hxa
#align multiset.range_disjoint_map_add Multiset.range_disjoint_map_add
theorem range_add_eq_union (a b : ℕ) : range (a + b) = range a ∪ (range b).map (a + ·) := by
rw [range_add, add_eq_union_iff_disjoint]
|
apply range_disjoint_map_add
|
theorem range_add_eq_union (a b : ℕ) : range (a + b) = range a ∪ (range b).map (a + ·) := by
rw [range_add, add_eq_union_iff_disjoint]
|
Mathlib.Data.Multiset.Range.74_0.3IYEfNCsb0H7K9Z
|
theorem range_add_eq_union (a b : ℕ) : range (a + b) = range a ∪ (range b).map (a + ·)
|
Mathlib_Data_Multiset_Range
|
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X✝ B : C
J : Type w
F : Discrete J ⥤ Over B
c : Cone F
X Y : WidePullbackShape J
f : X ⟶ Y
⊢ ((Functor.const (WidePullbackShape J)).obj c.pt.left).map f ≫
(fun X => Option.casesOn X c.pt.hom fun j => (c.π.app { as := j }).left) Y =
(fun X => Option.casesOn X c.pt.hom fun j => (c.π.app { as := j }).left) X ≫
(widePullbackDiagramOfDiagramOver B F).map f
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
|
dsimp
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.46_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X✝ B : C
J : Type w
F : Discrete J ⥤ Over B
c : Cone F
X Y : WidePullbackShape J
f : X ⟶ Y
⊢ 𝟙 c.pt.left ≫ Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) Y =
Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) X ≫
WidePullbackShape.Hom.rec (motive := fun a a_1 t =>
X = a →
Y = a_1 →
HEq f t →
(Option.rec B (fun val => (F.obj { as := val }).left) X ⟶
Option.rec B (fun val => (F.obj { as := val }).left) Y))
(fun X_1 h =>
Eq.rec (motive := fun x x_1 =>
Y = x →
HEq f (𝟙 x) →
(Option.rec B (fun val => (F.obj { as := val }).left) X ⟶
Option.rec B (fun val => (F.obj { as := val }).left) Y))
(fun h =>
Eq.rec (motive := fun x x_1 =>
(f : X ⟶ x) →
HEq f (𝟙 X) →
(Option.rec B (fun val => (F.obj { as := val }).left) X ⟶
Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => 𝟙 (Option.rec B (fun val => (F.obj { as := val }).left) X)) (_ : X = Y) f)
h)
(fun j h =>
Eq.rec (motive := fun x x_1 =>
(f : x ⟶ Y) →
Y = none →
HEq f (WidePullbackShape.Hom.term j) →
(Option.rec B (fun val => (F.obj { as := val }).left) x ⟶
Option.rec B (fun val => (F.obj { as := val }).left) Y))
(fun f h =>
Eq.rec (motive := fun x x_1 =>
(f : some j ⟶ x) →
HEq f (WidePullbackShape.Hom.term j) →
((F.obj { as := j }).left ⟶ Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => (F.obj { as := j }).hom) (_ : none = Y) f)
(_ : some j = X) f)
f (_ : X = X) (_ : Y = Y) (_ : HEq f f)
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp;
|
cases X
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp;
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.46_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
case none
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
c : Cone F
Y : WidePullbackShape J
f : none ⟶ Y
⊢ 𝟙 c.pt.left ≫ Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) Y =
Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) none ≫
WidePullbackShape.Hom.rec (motive := fun a a_1 t =>
none = a →
Y = a_1 →
HEq f t →
(Option.rec B (fun val => (F.obj { as := val }).left) none ⟶
Option.rec B (fun val => (F.obj { as := val }).left) Y))
(fun X h =>
Eq.rec (motive := fun x x_1 =>
Y = x →
HEq f (𝟙 x) →
(Option.rec B (fun val => (F.obj { as := val }).left) none ⟶
Option.rec B (fun val => (F.obj { as := val }).left) Y))
(fun h =>
Eq.rec (motive := fun x x_1 =>
(f : none ⟶ x) →
HEq f (𝟙 none) →
(Option.rec B (fun val => (F.obj { as := val }).left) none ⟶
Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => 𝟙 (Option.rec B (fun val => (F.obj { as := val }).left) none)) (_ : none = Y) f)
h)
(fun j h =>
Eq.rec (motive := fun x x_1 =>
(f : x ⟶ Y) →
Y = none →
HEq f (WidePullbackShape.Hom.term j) →
(Option.rec B (fun val => (F.obj { as := val }).left) x ⟶
Option.rec B (fun val => (F.obj { as := val }).left) Y))
(fun f h =>
Eq.rec (motive := fun x x_1 =>
(f : some j ⟶ x) →
HEq f (WidePullbackShape.Hom.term j) →
((F.obj { as := j }).left ⟶ Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => (F.obj { as := j }).hom) (_ : none = Y) f)
(_ : some j = none) f)
f (_ : none = none) (_ : Y = Y) (_ : HEq f f)
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;>
|
cases Y
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;>
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.46_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
case some
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
c : Cone F
Y : WidePullbackShape J
val✝ : J
f : some val✝ ⟶ Y
⊢ 𝟙 c.pt.left ≫ Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) Y =
Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) (some val✝) ≫
WidePullbackShape.Hom.rec (motive := fun a a_1 t =>
some val✝ = a →
Y = a_1 →
HEq f t →
(Option.rec B (fun val => (F.obj { as := val }).left) (some val✝) ⟶
Option.rec B (fun val => (F.obj { as := val }).left) Y))
(fun X h =>
Eq.rec (motive := fun x x_1 =>
Y = x →
HEq f (𝟙 x) →
(Option.rec B (fun val => (F.obj { as := val }).left) (some val✝) ⟶
Option.rec B (fun val => (F.obj { as := val }).left) Y))
(fun h =>
Eq.rec (motive := fun x x_1 =>
(f : some val✝ ⟶ x) →
HEq f (𝟙 (some val✝)) →
(Option.rec B (fun val => (F.obj { as := val }).left) (some val✝) ⟶
Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => 𝟙 (Option.rec B (fun val => (F.obj { as := val }).left) (some val✝))) (_ : some val✝ = Y) f)
h)
(fun j h =>
Eq.rec (motive := fun x x_1 =>
(f : x ⟶ Y) →
Y = none →
HEq f (WidePullbackShape.Hom.term j) →
(Option.rec B (fun val => (F.obj { as := val }).left) x ⟶
Option.rec B (fun val => (F.obj { as := val }).left) Y))
(fun f h =>
Eq.rec (motive := fun x x_1 =>
(f : some j ⟶ x) →
HEq f (WidePullbackShape.Hom.term j) →
((F.obj { as := j }).left ⟶ Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => (F.obj { as := j }).hom) (_ : none = Y) f)
(_ : some j = some val✝) f)
f (_ : some val✝ = some val✝) (_ : Y = Y) (_ : HEq f f)
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;>
|
cases Y
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;>
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.46_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
case none.none
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
c : Cone F
f : none ⟶ none
⊢ 𝟙 c.pt.left ≫ Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) none =
Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) none ≫
WidePullbackShape.Hom.rec (motive := fun a a_1 t =>
none = a →
none = a_1 →
HEq f t →
(Option.rec B (fun val => (F.obj { as := val }).left) none ⟶
Option.rec B (fun val => (F.obj { as := val }).left) none))
(fun X h =>
Eq.rec (motive := fun x x_1 =>
none = x →
HEq f (𝟙 x) →
(Option.rec B (fun val => (F.obj { as := val }).left) none ⟶
Option.rec B (fun val => (F.obj { as := val }).left) none))
(fun h =>
Eq.rec (motive := fun x x_1 =>
(f : none ⟶ x) →
HEq f (𝟙 none) →
(Option.rec B (fun val => (F.obj { as := val }).left) none ⟶
Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => 𝟙 (Option.rec B (fun val => (F.obj { as := val }).left) none)) (_ : none = none) f)
h)
(fun j h =>
Eq.rec (motive := fun x x_1 =>
(f : x ⟶ none) →
none = none →
HEq f (WidePullbackShape.Hom.term j) →
(Option.rec B (fun val => (F.obj { as := val }).left) x ⟶
Option.rec B (fun val => (F.obj { as := val }).left) none))
(fun f h =>
Eq.rec (motive := fun x x_1 =>
(f : some j ⟶ x) →
HEq f (WidePullbackShape.Hom.term j) →
((F.obj { as := j }).left ⟶ Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => (F.obj { as := j }).hom) (_ : none = none) f)
(_ : some j = none) f)
f (_ : none = none) (_ : none = none) (_ : HEq f f)
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;>
|
cases f
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;>
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.46_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
case none.some
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
c : Cone F
val✝ : J
f : none ⟶ some val✝
⊢ 𝟙 c.pt.left ≫ Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) (some val✝) =
Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) none ≫
WidePullbackShape.Hom.rec (motive := fun a a_1 t =>
none = a →
some val✝ = a_1 →
HEq f t →
(Option.rec B (fun val => (F.obj { as := val }).left) none ⟶
Option.rec B (fun val => (F.obj { as := val }).left) (some val✝)))
(fun X h =>
Eq.rec (motive := fun x x_1 =>
some val✝ = x →
HEq f (𝟙 x) →
(Option.rec B (fun val => (F.obj { as := val }).left) none ⟶
Option.rec B (fun val => (F.obj { as := val }).left) (some val✝)))
(fun h =>
Eq.rec (motive := fun x x_1 =>
(f : none ⟶ x) →
HEq f (𝟙 none) →
(Option.rec B (fun val => (F.obj { as := val }).left) none ⟶
Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => 𝟙 (Option.rec B (fun val => (F.obj { as := val }).left) none)) (_ : none = some val✝) f)
h)
(fun j h =>
Eq.rec (motive := fun x x_1 =>
(f : x ⟶ some val✝) →
some val✝ = none →
HEq f (WidePullbackShape.Hom.term j) →
(Option.rec B (fun val => (F.obj { as := val }).left) x ⟶
Option.rec B (fun val => (F.obj { as := val }).left) (some val✝)))
(fun f h =>
Eq.rec (motive := fun x x_1 =>
(f : some j ⟶ x) →
HEq f (WidePullbackShape.Hom.term j) →
((F.obj { as := j }).left ⟶ Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => (F.obj { as := j }).hom) (_ : none = some val✝) f)
(_ : some j = none) f)
f (_ : none = none) (_ : some val✝ = some val✝) (_ : HEq f f)
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;>
|
cases f
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;>
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.46_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
case some.none
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
c : Cone F
val✝ : J
f : some val✝ ⟶ none
⊢ 𝟙 c.pt.left ≫ Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) none =
Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) (some val✝) ≫
WidePullbackShape.Hom.rec (motive := fun a a_1 t =>
some val✝ = a →
none = a_1 →
HEq f t →
(Option.rec B (fun val => (F.obj { as := val }).left) (some val✝) ⟶
Option.rec B (fun val => (F.obj { as := val }).left) none))
(fun X h =>
Eq.rec (motive := fun x x_1 =>
none = x →
HEq f (𝟙 x) →
(Option.rec B (fun val => (F.obj { as := val }).left) (some val✝) ⟶
Option.rec B (fun val => (F.obj { as := val }).left) none))
(fun h =>
Eq.rec (motive := fun x x_1 =>
(f : some val✝ ⟶ x) →
HEq f (𝟙 (some val✝)) →
(Option.rec B (fun val => (F.obj { as := val }).left) (some val✝) ⟶
Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => 𝟙 (Option.rec B (fun val => (F.obj { as := val }).left) (some val✝))) (_ : some val✝ = none)
f)
h)
(fun j h =>
Eq.rec (motive := fun x x_1 =>
(f : x ⟶ none) →
none = none →
HEq f (WidePullbackShape.Hom.term j) →
(Option.rec B (fun val => (F.obj { as := val }).left) x ⟶
Option.rec B (fun val => (F.obj { as := val }).left) none))
(fun f h =>
Eq.rec (motive := fun x x_1 =>
(f : some j ⟶ x) →
HEq f (WidePullbackShape.Hom.term j) →
((F.obj { as := j }).left ⟶ Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => (F.obj { as := j }).hom) (_ : none = none) f)
(_ : some j = some val✝) f)
f (_ : some val✝ = some val✝) (_ : none = none) (_ : HEq f f)
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;>
|
cases f
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;>
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.46_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
case some.some
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
c : Cone F
val✝¹ val✝ : J
f : some val✝¹ ⟶ some val✝
⊢ 𝟙 c.pt.left ≫ Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) (some val✝) =
Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) (some val✝¹) ≫
WidePullbackShape.Hom.rec (motive := fun a a_1 t =>
some val✝¹ = a →
some val✝ = a_1 →
HEq f t →
(Option.rec B (fun val => (F.obj { as := val }).left) (some val✝¹) ⟶
Option.rec B (fun val => (F.obj { as := val }).left) (some val✝)))
(fun X h =>
Eq.rec (motive := fun x x_1 =>
some val✝ = x →
HEq f (𝟙 x) →
(Option.rec B (fun val => (F.obj { as := val }).left) (some val✝¹) ⟶
Option.rec B (fun val => (F.obj { as := val }).left) (some val✝)))
(fun h =>
Eq.rec (motive := fun x x_1 =>
(f : some val✝¹ ⟶ x) →
HEq f (𝟙 (some val✝¹)) →
(Option.rec B (fun val => (F.obj { as := val }).left) (some val✝¹) ⟶
Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => 𝟙 (Option.rec B (fun val => (F.obj { as := val }).left) (some val✝¹)))
(_ : some val✝¹ = some val✝) f)
h)
(fun j h =>
Eq.rec (motive := fun x x_1 =>
(f : x ⟶ some val✝) →
some val✝ = none →
HEq f (WidePullbackShape.Hom.term j) →
(Option.rec B (fun val => (F.obj { as := val }).left) x ⟶
Option.rec B (fun val => (F.obj { as := val }).left) (some val✝)))
(fun f h =>
Eq.rec (motive := fun x x_1 =>
(f : some j ⟶ x) →
HEq f (WidePullbackShape.Hom.term j) →
((F.obj { as := j }).left ⟶ Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => (F.obj { as := j }).hom) (_ : none = some val✝) f)
(_ : some j = some val✝¹) f)
f (_ : some val✝¹ = some val✝¹) (_ : some val✝ = some val✝) (_ : HEq f f)
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;>
|
cases f
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;>
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.46_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
case none.none.id
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
c : Cone F
⊢ 𝟙 c.pt.left ≫ Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) none =
Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) none ≫
WidePullbackShape.Hom.rec (motive := fun a a_1 t =>
none = a →
none = a_1 →
HEq (WidePullbackShape.Hom.id none) t →
(Option.rec B (fun val => (F.obj { as := val }).left) none ⟶
Option.rec B (fun val => (F.obj { as := val }).left) none))
(fun X h =>
Eq.rec (motive := fun x x_1 =>
none = x →
HEq (WidePullbackShape.Hom.id none) (𝟙 x) →
(Option.rec B (fun val => (F.obj { as := val }).left) none ⟶
Option.rec B (fun val => (F.obj { as := val }).left) none))
(fun h =>
Eq.rec (motive := fun x x_1 =>
(f : none ⟶ x) →
HEq f (𝟙 none) →
(Option.rec B (fun val => (F.obj { as := val }).left) none ⟶
Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => 𝟙 (Option.rec B (fun val => (F.obj { as := val }).left) none)) (_ : none = none)
(WidePullbackShape.Hom.id none))
h)
(fun j h =>
Eq.rec (motive := fun x x_1 =>
(f : x ⟶ none) →
none = none →
HEq f (WidePullbackShape.Hom.term j) →
(Option.rec B (fun val => (F.obj { as := val }).left) x ⟶
Option.rec B (fun val => (F.obj { as := val }).left) none))
(fun f h =>
Eq.rec (motive := fun x x_1 =>
(f : some j ⟶ x) →
HEq f (WidePullbackShape.Hom.term j) →
((F.obj { as := j }).left ⟶ Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => (F.obj { as := j }).hom) (_ : none = none) f)
(_ : some j = none) (WidePullbackShape.Hom.id none))
(WidePullbackShape.Hom.id none) (_ : none = none) (_ : none = none)
(_ : HEq (WidePullbackShape.Hom.id none) (WidePullbackShape.Hom.id none))
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
·
|
rw [Category.id_comp, Category.comp_id]
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
·
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.46_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
case some.none.term
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
c : Cone F
val✝ : J
⊢ 𝟙 c.pt.left ≫ Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) none =
Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) (some val✝) ≫
WidePullbackShape.Hom.rec (motive := fun a a_1 t =>
some val✝ = a →
none = a_1 →
HEq (WidePullbackShape.Hom.term val✝) t →
(Option.rec B (fun val => (F.obj { as := val }).left) (some val✝) ⟶
Option.rec B (fun val => (F.obj { as := val }).left) none))
(fun X h =>
Eq.rec (motive := fun x x_1 =>
none = x →
HEq (WidePullbackShape.Hom.term val✝) (𝟙 x) →
(Option.rec B (fun val => (F.obj { as := val }).left) (some val✝) ⟶
Option.rec B (fun val => (F.obj { as := val }).left) none))
(fun h =>
Eq.rec (motive := fun x x_1 =>
(f : some val✝ ⟶ x) →
HEq f (𝟙 (some val✝)) →
(Option.rec B (fun val => (F.obj { as := val }).left) (some val✝) ⟶
Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => 𝟙 (Option.rec B (fun val => (F.obj { as := val }).left) (some val✝))) (_ : some val✝ = none)
(WidePullbackShape.Hom.term val✝))
h)
(fun j h =>
Eq.rec (motive := fun x x_1 =>
(f : x ⟶ none) →
none = none →
HEq f (WidePullbackShape.Hom.term j) →
(Option.rec B (fun val => (F.obj { as := val }).left) x ⟶
Option.rec B (fun val => (F.obj { as := val }).left) none))
(fun f h =>
Eq.rec (motive := fun x x_1 =>
(f : some j ⟶ x) →
HEq f (WidePullbackShape.Hom.term j) →
((F.obj { as := j }).left ⟶ Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => (F.obj { as := j }).hom) (_ : none = none) f)
(_ : some j = some val✝) (WidePullbackShape.Hom.term val✝))
(WidePullbackShape.Hom.term val✝) (_ : some val✝ = some val✝) (_ : none = none)
(_ : HEq (WidePullbackShape.Hom.term val✝) (WidePullbackShape.Hom.term val✝))
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
·
|
rw [Over.w, Category.id_comp]
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
·
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.46_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
case some.some.id
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
c : Cone F
val✝ : J
⊢ 𝟙 c.pt.left ≫ Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) (some val✝) =
Option.rec c.pt.hom (fun val => (c.π.app { as := val }).left) (some val✝) ≫
WidePullbackShape.Hom.rec (motive := fun a a_1 t =>
some val✝ = a →
some val✝ = a_1 →
HEq (WidePullbackShape.Hom.id (some val✝)) t →
(Option.rec B (fun val => (F.obj { as := val }).left) (some val✝) ⟶
Option.rec B (fun val => (F.obj { as := val }).left) (some val✝)))
(fun X h =>
Eq.rec (motive := fun x x_1 =>
some val✝ = x →
HEq (WidePullbackShape.Hom.id (some val✝)) (𝟙 x) →
(Option.rec B (fun val => (F.obj { as := val }).left) (some val✝) ⟶
Option.rec B (fun val => (F.obj { as := val }).left) (some val✝)))
(fun h =>
Eq.rec (motive := fun x x_1 =>
(f : some val✝ ⟶ x) →
HEq f (𝟙 (some val✝)) →
(Option.rec B (fun val => (F.obj { as := val }).left) (some val✝) ⟶
Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => 𝟙 (Option.rec B (fun val => (F.obj { as := val }).left) (some val✝)))
(_ : some val✝ = some val✝) (WidePullbackShape.Hom.id (some val✝)))
h)
(fun j h =>
Eq.rec (motive := fun x x_1 =>
(f : x ⟶ some val✝) →
some val✝ = none →
HEq f (WidePullbackShape.Hom.term j) →
(Option.rec B (fun val => (F.obj { as := val }).left) x ⟶
Option.rec B (fun val => (F.obj { as := val }).left) (some val✝)))
(fun f h =>
Eq.rec (motive := fun x x_1 =>
(f : some j ⟶ x) →
HEq f (WidePullbackShape.Hom.term j) →
((F.obj { as := j }).left ⟶ Option.rec B (fun val => (F.obj { as := val }).left) x))
(fun f h => (F.obj { as := j }).hom) (_ : none = some val✝) f)
(_ : some j = some val✝) (WidePullbackShape.Hom.id (some val✝)))
(WidePullbackShape.Hom.id (some val✝)) (_ : some val✝ = some val✝) (_ : some val✝ = some val✝)
(_ : HEq (WidePullbackShape.Hom.id (some val✝)) (WidePullbackShape.Hom.id (some val✝)))
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
· rw [Over.w, Category.id_comp]
·
|
rw [Category.id_comp, Category.comp_id]
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
· rw [Over.w, Category.id_comp]
·
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.46_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
X✝ Y✝ : Cone F
f : X✝ ⟶ Y✝
j : WidePullbackShape J
⊢ f.hom.left ≫ (conesEquivInverseObj B F Y✝).π.app j = (conesEquivInverseObj B F X✝).π.app j
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
· rw [Over.w, Category.id_comp]
· rw [Category.id_comp, Category.comp_id] }
#align category_theory.over.construct_products.cones_equiv_inverse_obj CategoryTheory.Over.ConstructProducts.conesEquivInverseObj
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
|
cases' j with j
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.61_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
case none
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
X✝ Y✝ : Cone F
f : X✝ ⟶ Y✝
⊢ f.hom.left ≫ (conesEquivInverseObj B F Y✝).π.app none = (conesEquivInverseObj B F X✝).π.app none
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
· rw [Over.w, Category.id_comp]
· rw [Category.id_comp, Category.comp_id] }
#align category_theory.over.construct_products.cones_equiv_inverse_obj CategoryTheory.Over.ConstructProducts.conesEquivInverseObj
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
cases' j with j
·
|
simp
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
cases' j with j
·
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.61_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
case some
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
X✝ Y✝ : Cone F
f : X✝ ⟶ Y✝
j : J
⊢ f.hom.left ≫ (conesEquivInverseObj B F Y✝).π.app (some j) = (conesEquivInverseObj B F X✝).π.app (some j)
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
· rw [Over.w, Category.id_comp]
· rw [Category.id_comp, Category.comp_id] }
#align category_theory.over.construct_products.cones_equiv_inverse_obj CategoryTheory.Over.ConstructProducts.conesEquivInverseObj
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
cases' j with j
· simp
·
|
dsimp
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
cases' j with j
· simp
·
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.61_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
case some
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
X✝ Y✝ : Cone F
f : X✝ ⟶ Y✝
j : J
⊢ f.hom.left ≫ (Y✝.π.app { as := j }).left = (X✝.π.app { as := j }).left
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
· rw [Over.w, Category.id_comp]
· rw [Category.id_comp, Category.comp_id] }
#align category_theory.over.construct_products.cones_equiv_inverse_obj CategoryTheory.Over.ConstructProducts.conesEquivInverseObj
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
cases' j with j
· simp
· dsimp
|
rw [← f.w ⟨j⟩]
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
cases' j with j
· simp
· dsimp
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.61_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
case some
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
J : Type w
F : Discrete J ⥤ Over B
X✝ Y✝ : Cone F
f : X✝ ⟶ Y✝
j : J
⊢ f.hom.left ≫ (Y✝.π.app { as := j }).left = (f.hom ≫ Y✝.π.app { as := j }).left
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
· rw [Over.w, Category.id_comp]
· rw [Category.id_comp, Category.comp_id] }
#align category_theory.over.construct_products.cones_equiv_inverse_obj CategoryTheory.Over.ConstructProducts.conesEquivInverseObj
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
cases' j with j
· simp
· dsimp
rw [← f.w ⟨j⟩]
|
rfl
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
cases' j with j
· simp
· dsimp
rw [← f.w ⟨j⟩]
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.61_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X✝ B : C
J : Type w
F : Discrete J ⥤ Over B
c : Cone (widePullbackDiagramOfDiagramOver B F)
x✝² x✝¹ : Discrete J
X Y : J
x✝ : { as := X } ⟶ { as := Y }
f : { as := X }.as = { as := Y }.as
⊢ ((Functor.const (Discrete J)).obj (mk (c.π.app none))).map { down := { down := f } } ≫
(fun x =>
match x with
| { as := j } => homMk (c.π.app (some j)))
{ as := Y } =
(fun x =>
match x with
| { as := j } => homMk (c.π.app (some j)))
{ as := X } ≫
F.map { down := { down := f } }
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
· rw [Over.w, Category.id_comp]
· rw [Category.id_comp, Category.comp_id] }
#align category_theory.over.construct_products.cones_equiv_inverse_obj CategoryTheory.Over.ConstructProducts.conesEquivInverseObj
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
cases' j with j
· simp
· dsimp
rw [← f.w ⟨j⟩]
rfl }
#align category_theory.over.construct_products.cones_equiv_inverse CategoryTheory.Over.ConstructProducts.conesEquivInverse
-- Porting note: this should help with the additional `naturality` proof we now have to give in
-- `conesEquivFunctor`, but doesn't.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] Discrete
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivFunctor (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ⥤ Cone F where
obj c :=
{ pt := Over.mk (c.π.app none)
π :=
{ app := fun ⟨j⟩ => Over.homMk (c.π.app (some j)) (c.w (WidePullbackShape.Hom.term j))
-- Porting note: Added a proof for `naturality`
naturality := fun ⟨X⟩ ⟨Y⟩ ⟨⟨f⟩⟩ => by
|
dsimp at f ⊢
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivFunctor (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ⥤ Cone F where
obj c :=
{ pt := Over.mk (c.π.app none)
π :=
{ app := fun ⟨j⟩ => Over.homMk (c.π.app (some j)) (c.w (WidePullbackShape.Hom.term j))
-- Porting note: Added a proof for `naturality`
naturality := fun ⟨X⟩ ⟨Y⟩ ⟨⟨f⟩⟩ => by
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.80_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivFunctor (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ⥤ Cone F where
obj c
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
J✝ : Type w
C : Type u
inst✝ : Category.{v, u} C
X✝ B : C
J : Type w
F : Discrete J ⥤ Over B
c : Cone (widePullbackDiagramOfDiagramOver B F)
x✝² x✝¹ : Discrete J
X Y : J
x✝ : { as := X } ⟶ { as := Y }
f : X = Y
⊢ 𝟙 (mk (c.π.app none)) ≫ homMk (c.π.app (some Y)) = homMk (c.π.app (some X)) ≫ F.map { down := { down := f } }
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
· rw [Over.w, Category.id_comp]
· rw [Category.id_comp, Category.comp_id] }
#align category_theory.over.construct_products.cones_equiv_inverse_obj CategoryTheory.Over.ConstructProducts.conesEquivInverseObj
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
cases' j with j
· simp
· dsimp
rw [← f.w ⟨j⟩]
rfl }
#align category_theory.over.construct_products.cones_equiv_inverse CategoryTheory.Over.ConstructProducts.conesEquivInverse
-- Porting note: this should help with the additional `naturality` proof we now have to give in
-- `conesEquivFunctor`, but doesn't.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] Discrete
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivFunctor (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ⥤ Cone F where
obj c :=
{ pt := Over.mk (c.π.app none)
π :=
{ app := fun ⟨j⟩ => Over.homMk (c.π.app (some j)) (c.w (WidePullbackShape.Hom.term j))
-- Porting note: Added a proof for `naturality`
naturality := fun ⟨X⟩ ⟨Y⟩ ⟨⟨f⟩⟩ => by dsimp at f ⊢;
|
aesop_cat
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivFunctor (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ⥤ Cone F where
obj c :=
{ pt := Over.mk (c.π.app none)
π :=
{ app := fun ⟨j⟩ => Over.homMk (c.π.app (some j)) (c.w (WidePullbackShape.Hom.term j))
-- Porting note: Added a proof for `naturality`
naturality := fun ⟨X⟩ ⟨Y⟩ ⟨⟨f⟩⟩ => by dsimp at f ⊢;
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.80_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivFunctor (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ⥤ Cone F where
obj c
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
J : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
F : Discrete J ⥤ Over B
x✝ : Cone (widePullbackDiagramOfDiagramOver B F)
⊢ ∀ (j : WidePullbackShape J),
((𝟭 (Cone (widePullbackDiagramOfDiagramOver B F))).obj x✝).π.app j =
(Iso.mk (𝟙 ((𝟭 (Cone (widePullbackDiagramOfDiagramOver B F))).obj x✝).pt)
(𝟙 ((conesEquivFunctor B F ⋙ conesEquivInverse B F).obj x✝).pt)).hom ≫
((conesEquivFunctor B F ⋙ conesEquivInverse B F).obj x✝).π.app j
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
· rw [Over.w, Category.id_comp]
· rw [Category.id_comp, Category.comp_id] }
#align category_theory.over.construct_products.cones_equiv_inverse_obj CategoryTheory.Over.ConstructProducts.conesEquivInverseObj
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
cases' j with j
· simp
· dsimp
rw [← f.w ⟨j⟩]
rfl }
#align category_theory.over.construct_products.cones_equiv_inverse CategoryTheory.Over.ConstructProducts.conesEquivInverse
-- Porting note: this should help with the additional `naturality` proof we now have to give in
-- `conesEquivFunctor`, but doesn't.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] Discrete
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivFunctor (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ⥤ Cone F where
obj c :=
{ pt := Over.mk (c.π.app none)
π :=
{ app := fun ⟨j⟩ => Over.homMk (c.π.app (some j)) (c.w (WidePullbackShape.Hom.term j))
-- Porting note: Added a proof for `naturality`
naturality := fun ⟨X⟩ ⟨Y⟩ ⟨⟨f⟩⟩ => by dsimp at f ⊢; aesop_cat } }
map f := { hom := Over.homMk f.hom }
#align category_theory.over.construct_products.cones_equiv_functor CategoryTheory.Over.ConstructProducts.conesEquivFunctor
-- Porting note: unfortunately `aesop` can't cope with a `cases` rule here for the type synonym
-- `WidePullbackShape`.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] WidePullbackShape
-- If this worked we could avoid the `rintro` in `conesEquivUnitIso`.
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivUnitIso (B : C) (F : Discrete J ⥤ Over B) :
𝟭 (Cone (widePullbackDiagramOfDiagramOver B F)) ≅
conesEquivFunctor B F ⋙ conesEquivInverse B F :=
NatIso.ofComponents fun _ => Cones.ext
{ hom := 𝟙 _
inv := 𝟙 _ }
(by
|
rintro (j | j)
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivUnitIso (B : C) (F : Discrete J ⥤ Over B) :
𝟭 (Cone (widePullbackDiagramOfDiagramOver B F)) ≅
conesEquivFunctor B F ⋙ conesEquivInverse B F :=
NatIso.ofComponents fun _ => Cones.ext
{ hom := 𝟙 _
inv := 𝟙 _ }
(by
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.98_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivUnitIso (B : C) (F : Discrete J ⥤ Over B) :
𝟭 (Cone (widePullbackDiagramOfDiagramOver B F)) ≅
conesEquivFunctor B F ⋙ conesEquivInverse B F
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
case none
J : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
F : Discrete J ⥤ Over B
x✝ : Cone (widePullbackDiagramOfDiagramOver B F)
⊢ ((𝟭 (Cone (widePullbackDiagramOfDiagramOver B F))).obj x✝).π.app none =
(Iso.mk (𝟙 ((𝟭 (Cone (widePullbackDiagramOfDiagramOver B F))).obj x✝).pt)
(𝟙 ((conesEquivFunctor B F ⋙ conesEquivInverse B F).obj x✝).pt)).hom ≫
((conesEquivFunctor B F ⋙ conesEquivInverse B F).obj x✝).π.app none
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
· rw [Over.w, Category.id_comp]
· rw [Category.id_comp, Category.comp_id] }
#align category_theory.over.construct_products.cones_equiv_inverse_obj CategoryTheory.Over.ConstructProducts.conesEquivInverseObj
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
cases' j with j
· simp
· dsimp
rw [← f.w ⟨j⟩]
rfl }
#align category_theory.over.construct_products.cones_equiv_inverse CategoryTheory.Over.ConstructProducts.conesEquivInverse
-- Porting note: this should help with the additional `naturality` proof we now have to give in
-- `conesEquivFunctor`, but doesn't.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] Discrete
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivFunctor (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ⥤ Cone F where
obj c :=
{ pt := Over.mk (c.π.app none)
π :=
{ app := fun ⟨j⟩ => Over.homMk (c.π.app (some j)) (c.w (WidePullbackShape.Hom.term j))
-- Porting note: Added a proof for `naturality`
naturality := fun ⟨X⟩ ⟨Y⟩ ⟨⟨f⟩⟩ => by dsimp at f ⊢; aesop_cat } }
map f := { hom := Over.homMk f.hom }
#align category_theory.over.construct_products.cones_equiv_functor CategoryTheory.Over.ConstructProducts.conesEquivFunctor
-- Porting note: unfortunately `aesop` can't cope with a `cases` rule here for the type synonym
-- `WidePullbackShape`.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] WidePullbackShape
-- If this worked we could avoid the `rintro` in `conesEquivUnitIso`.
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivUnitIso (B : C) (F : Discrete J ⥤ Over B) :
𝟭 (Cone (widePullbackDiagramOfDiagramOver B F)) ≅
conesEquivFunctor B F ⋙ conesEquivInverse B F :=
NatIso.ofComponents fun _ => Cones.ext
{ hom := 𝟙 _
inv := 𝟙 _ }
(by rintro (j | j) <;>
|
aesop_cat
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivUnitIso (B : C) (F : Discrete J ⥤ Over B) :
𝟭 (Cone (widePullbackDiagramOfDiagramOver B F)) ≅
conesEquivFunctor B F ⋙ conesEquivInverse B F :=
NatIso.ofComponents fun _ => Cones.ext
{ hom := 𝟙 _
inv := 𝟙 _ }
(by rintro (j | j) <;>
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.98_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivUnitIso (B : C) (F : Discrete J ⥤ Over B) :
𝟭 (Cone (widePullbackDiagramOfDiagramOver B F)) ≅
conesEquivFunctor B F ⋙ conesEquivInverse B F
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
case some
J : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
F : Discrete J ⥤ Over B
x✝ : Cone (widePullbackDiagramOfDiagramOver B F)
j : J
⊢ ((𝟭 (Cone (widePullbackDiagramOfDiagramOver B F))).obj x✝).π.app (some j) =
(Iso.mk (𝟙 ((𝟭 (Cone (widePullbackDiagramOfDiagramOver B F))).obj x✝).pt)
(𝟙 ((conesEquivFunctor B F ⋙ conesEquivInverse B F).obj x✝).pt)).hom ≫
((conesEquivFunctor B F ⋙ conesEquivInverse B F).obj x✝).π.app (some j)
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
· rw [Over.w, Category.id_comp]
· rw [Category.id_comp, Category.comp_id] }
#align category_theory.over.construct_products.cones_equiv_inverse_obj CategoryTheory.Over.ConstructProducts.conesEquivInverseObj
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
cases' j with j
· simp
· dsimp
rw [← f.w ⟨j⟩]
rfl }
#align category_theory.over.construct_products.cones_equiv_inverse CategoryTheory.Over.ConstructProducts.conesEquivInverse
-- Porting note: this should help with the additional `naturality` proof we now have to give in
-- `conesEquivFunctor`, but doesn't.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] Discrete
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivFunctor (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ⥤ Cone F where
obj c :=
{ pt := Over.mk (c.π.app none)
π :=
{ app := fun ⟨j⟩ => Over.homMk (c.π.app (some j)) (c.w (WidePullbackShape.Hom.term j))
-- Porting note: Added a proof for `naturality`
naturality := fun ⟨X⟩ ⟨Y⟩ ⟨⟨f⟩⟩ => by dsimp at f ⊢; aesop_cat } }
map f := { hom := Over.homMk f.hom }
#align category_theory.over.construct_products.cones_equiv_functor CategoryTheory.Over.ConstructProducts.conesEquivFunctor
-- Porting note: unfortunately `aesop` can't cope with a `cases` rule here for the type synonym
-- `WidePullbackShape`.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] WidePullbackShape
-- If this worked we could avoid the `rintro` in `conesEquivUnitIso`.
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivUnitIso (B : C) (F : Discrete J ⥤ Over B) :
𝟭 (Cone (widePullbackDiagramOfDiagramOver B F)) ≅
conesEquivFunctor B F ⋙ conesEquivInverse B F :=
NatIso.ofComponents fun _ => Cones.ext
{ hom := 𝟙 _
inv := 𝟙 _ }
(by rintro (j | j) <;>
|
aesop_cat
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivUnitIso (B : C) (F : Discrete J ⥤ Over B) :
𝟭 (Cone (widePullbackDiagramOfDiagramOver B F)) ≅
conesEquivFunctor B F ⋙ conesEquivInverse B F :=
NatIso.ofComponents fun _ => Cones.ext
{ hom := 𝟙 _
inv := 𝟙 _ }
(by rintro (j | j) <;>
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.98_0.USyhUKjMzubPAtG
|
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivUnitIso (B : C) (F : Discrete J ⥤ Over B) :
𝟭 (Cone (widePullbackDiagramOfDiagramOver B F)) ≅
conesEquivFunctor B F ⋙ conesEquivInverse B F
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
J : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
F : Discrete PEmpty.{1} ⥤ Over B
s : Cone F
m : s.pt ⟶ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.pt
x✝ : ∀ (j : Discrete PEmpty.{1}), m ≫ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.π.app j = s.π.app j
⊢ m = (fun s => homMk s.pt.hom) s
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
· rw [Over.w, Category.id_comp]
· rw [Category.id_comp, Category.comp_id] }
#align category_theory.over.construct_products.cones_equiv_inverse_obj CategoryTheory.Over.ConstructProducts.conesEquivInverseObj
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
cases' j with j
· simp
· dsimp
rw [← f.w ⟨j⟩]
rfl }
#align category_theory.over.construct_products.cones_equiv_inverse CategoryTheory.Over.ConstructProducts.conesEquivInverse
-- Porting note: this should help with the additional `naturality` proof we now have to give in
-- `conesEquivFunctor`, but doesn't.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] Discrete
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivFunctor (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ⥤ Cone F where
obj c :=
{ pt := Over.mk (c.π.app none)
π :=
{ app := fun ⟨j⟩ => Over.homMk (c.π.app (some j)) (c.w (WidePullbackShape.Hom.term j))
-- Porting note: Added a proof for `naturality`
naturality := fun ⟨X⟩ ⟨Y⟩ ⟨⟨f⟩⟩ => by dsimp at f ⊢; aesop_cat } }
map f := { hom := Over.homMk f.hom }
#align category_theory.over.construct_products.cones_equiv_functor CategoryTheory.Over.ConstructProducts.conesEquivFunctor
-- Porting note: unfortunately `aesop` can't cope with a `cases` rule here for the type synonym
-- `WidePullbackShape`.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] WidePullbackShape
-- If this worked we could avoid the `rintro` in `conesEquivUnitIso`.
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivUnitIso (B : C) (F : Discrete J ⥤ Over B) :
𝟭 (Cone (widePullbackDiagramOfDiagramOver B F)) ≅
conesEquivFunctor B F ⋙ conesEquivInverse B F :=
NatIso.ofComponents fun _ => Cones.ext
{ hom := 𝟙 _
inv := 𝟙 _ }
(by rintro (j | j) <;> aesop_cat)
#align category_theory.over.construct_products.cones_equiv_unit_iso CategoryTheory.Over.ConstructProducts.conesEquivUnitIso
-- TODO: Can we add `:= by aesop` to the second arguments of `NatIso.ofComponents` and
-- `Cones.ext`?
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivCounitIso (B : C) (F : Discrete J ⥤ Over B) :
conesEquivInverse B F ⋙ conesEquivFunctor B F ≅ 𝟭 (Cone F) :=
NatIso.ofComponents fun _ => Cones.ext
{ hom := Over.homMk (𝟙 _)
inv := Over.homMk (𝟙 _) }
#align category_theory.over.construct_products.cones_equiv_counit_iso CategoryTheory.Over.ConstructProducts.conesEquivCounitIso
/-- (Impl) Establish an equivalence between the category of cones for `F` and for the "grown" `F`.
-/
@[simps]
def conesEquiv (B : C) (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ≌ Cone F where
functor := conesEquivFunctor B F
inverse := conesEquivInverse B F
unitIso := conesEquivUnitIso B F
counitIso := conesEquivCounitIso B F
#align category_theory.over.construct_products.cones_equiv CategoryTheory.Over.ConstructProducts.conesEquiv
/-- Use the above equivalence to prove we have a limit. -/
theorem has_over_limit_discrete_of_widePullback_limit {B : C} (F : Discrete J ⥤ Over B)
[HasLimit (widePullbackDiagramOfDiagramOver B F)] : HasLimit F :=
HasLimit.mk
{ cone := _
isLimit := IsLimit.ofRightAdjoint (conesEquiv B F).functor
(limit.isLimit (widePullbackDiagramOfDiagramOver B F)) }
#align category_theory.over.construct_products.has_over_limit_discrete_of_wide_pullback_limit CategoryTheory.Over.ConstructProducts.has_over_limit_discrete_of_widePullback_limit
/-- Given a wide pullback in `C`, construct a product in `C/B`. -/
theorem over_product_of_widePullback [HasLimitsOfShape (WidePullbackShape J) C] {B : C} :
HasLimitsOfShape (Discrete J) (Over B) :=
{ has_limit := fun F => has_over_limit_discrete_of_widePullback_limit F }
#align category_theory.over.construct_products.over_product_of_wide_pullback CategoryTheory.Over.ConstructProducts.over_product_of_widePullback
/-- Given a pullback in `C`, construct a binary product in `C/B`. -/
theorem over_binaryProduct_of_pullback [HasPullbacks C] {B : C} : HasBinaryProducts (Over B) :=
over_product_of_widePullback
#align category_theory.over.construct_products.over_binary_product_of_pullback CategoryTheory.Over.ConstructProducts.over_binaryProduct_of_pullback
/-- Given all wide pullbacks in `C`, construct products in `C/B`. -/
theorem over_products_of_widePullbacks [HasWidePullbacks.{w} C] {B : C} :
HasProducts.{w} (Over B) :=
fun _ => over_product_of_widePullback
#align category_theory.over.construct_products.over_products_of_wide_pullbacks CategoryTheory.Over.ConstructProducts.over_products_of_widePullbacks
/-- Given all finite wide pullbacks in `C`, construct finite products in `C/B`. -/
theorem over_finiteProducts_of_finiteWidePullbacks [HasFiniteWidePullbacks C] {B : C} :
HasFiniteProducts (Over B) :=
⟨fun _ => over_product_of_widePullback⟩
#align category_theory.over.construct_products.over_finite_products_of_finite_wide_pullbacks CategoryTheory.Over.ConstructProducts.over_finiteProducts_of_finiteWidePullbacks
end ConstructProducts
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
has_limit F := HasLimit.mk
{ cone :=
{ pt := Over.mk (𝟙 _)
π :=
{ app := fun p => p.as.elim } }
isLimit :=
{ lift := fun s => Over.homMk _
fac := fun _ j => j.as.elim
uniq := fun s m _ => by
|
simp only
|
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
has_limit F := HasLimit.mk
{ cone :=
{ pt := Over.mk (𝟙 _)
π :=
{ app := fun p => p.as.elim } }
isLimit :=
{ lift := fun s => Over.homMk _
fac := fun _ j => j.as.elim
uniq := fun s m _ => by
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.165_0.USyhUKjMzubPAtG
|
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
has_limit F
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
J : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
F : Discrete PEmpty.{1} ⥤ Over B
s : Cone F
m : s.pt ⟶ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.pt
x✝ : ∀ (j : Discrete PEmpty.{1}), m ≫ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.π.app j = s.π.app j
⊢ m = homMk s.pt.hom
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
· rw [Over.w, Category.id_comp]
· rw [Category.id_comp, Category.comp_id] }
#align category_theory.over.construct_products.cones_equiv_inverse_obj CategoryTheory.Over.ConstructProducts.conesEquivInverseObj
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
cases' j with j
· simp
· dsimp
rw [← f.w ⟨j⟩]
rfl }
#align category_theory.over.construct_products.cones_equiv_inverse CategoryTheory.Over.ConstructProducts.conesEquivInverse
-- Porting note: this should help with the additional `naturality` proof we now have to give in
-- `conesEquivFunctor`, but doesn't.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] Discrete
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivFunctor (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ⥤ Cone F where
obj c :=
{ pt := Over.mk (c.π.app none)
π :=
{ app := fun ⟨j⟩ => Over.homMk (c.π.app (some j)) (c.w (WidePullbackShape.Hom.term j))
-- Porting note: Added a proof for `naturality`
naturality := fun ⟨X⟩ ⟨Y⟩ ⟨⟨f⟩⟩ => by dsimp at f ⊢; aesop_cat } }
map f := { hom := Over.homMk f.hom }
#align category_theory.over.construct_products.cones_equiv_functor CategoryTheory.Over.ConstructProducts.conesEquivFunctor
-- Porting note: unfortunately `aesop` can't cope with a `cases` rule here for the type synonym
-- `WidePullbackShape`.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] WidePullbackShape
-- If this worked we could avoid the `rintro` in `conesEquivUnitIso`.
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivUnitIso (B : C) (F : Discrete J ⥤ Over B) :
𝟭 (Cone (widePullbackDiagramOfDiagramOver B F)) ≅
conesEquivFunctor B F ⋙ conesEquivInverse B F :=
NatIso.ofComponents fun _ => Cones.ext
{ hom := 𝟙 _
inv := 𝟙 _ }
(by rintro (j | j) <;> aesop_cat)
#align category_theory.over.construct_products.cones_equiv_unit_iso CategoryTheory.Over.ConstructProducts.conesEquivUnitIso
-- TODO: Can we add `:= by aesop` to the second arguments of `NatIso.ofComponents` and
-- `Cones.ext`?
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivCounitIso (B : C) (F : Discrete J ⥤ Over B) :
conesEquivInverse B F ⋙ conesEquivFunctor B F ≅ 𝟭 (Cone F) :=
NatIso.ofComponents fun _ => Cones.ext
{ hom := Over.homMk (𝟙 _)
inv := Over.homMk (𝟙 _) }
#align category_theory.over.construct_products.cones_equiv_counit_iso CategoryTheory.Over.ConstructProducts.conesEquivCounitIso
/-- (Impl) Establish an equivalence between the category of cones for `F` and for the "grown" `F`.
-/
@[simps]
def conesEquiv (B : C) (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ≌ Cone F where
functor := conesEquivFunctor B F
inverse := conesEquivInverse B F
unitIso := conesEquivUnitIso B F
counitIso := conesEquivCounitIso B F
#align category_theory.over.construct_products.cones_equiv CategoryTheory.Over.ConstructProducts.conesEquiv
/-- Use the above equivalence to prove we have a limit. -/
theorem has_over_limit_discrete_of_widePullback_limit {B : C} (F : Discrete J ⥤ Over B)
[HasLimit (widePullbackDiagramOfDiagramOver B F)] : HasLimit F :=
HasLimit.mk
{ cone := _
isLimit := IsLimit.ofRightAdjoint (conesEquiv B F).functor
(limit.isLimit (widePullbackDiagramOfDiagramOver B F)) }
#align category_theory.over.construct_products.has_over_limit_discrete_of_wide_pullback_limit CategoryTheory.Over.ConstructProducts.has_over_limit_discrete_of_widePullback_limit
/-- Given a wide pullback in `C`, construct a product in `C/B`. -/
theorem over_product_of_widePullback [HasLimitsOfShape (WidePullbackShape J) C] {B : C} :
HasLimitsOfShape (Discrete J) (Over B) :=
{ has_limit := fun F => has_over_limit_discrete_of_widePullback_limit F }
#align category_theory.over.construct_products.over_product_of_wide_pullback CategoryTheory.Over.ConstructProducts.over_product_of_widePullback
/-- Given a pullback in `C`, construct a binary product in `C/B`. -/
theorem over_binaryProduct_of_pullback [HasPullbacks C] {B : C} : HasBinaryProducts (Over B) :=
over_product_of_widePullback
#align category_theory.over.construct_products.over_binary_product_of_pullback CategoryTheory.Over.ConstructProducts.over_binaryProduct_of_pullback
/-- Given all wide pullbacks in `C`, construct products in `C/B`. -/
theorem over_products_of_widePullbacks [HasWidePullbacks.{w} C] {B : C} :
HasProducts.{w} (Over B) :=
fun _ => over_product_of_widePullback
#align category_theory.over.construct_products.over_products_of_wide_pullbacks CategoryTheory.Over.ConstructProducts.over_products_of_widePullbacks
/-- Given all finite wide pullbacks in `C`, construct finite products in `C/B`. -/
theorem over_finiteProducts_of_finiteWidePullbacks [HasFiniteWidePullbacks C] {B : C} :
HasFiniteProducts (Over B) :=
⟨fun _ => over_product_of_widePullback⟩
#align category_theory.over.construct_products.over_finite_products_of_finite_wide_pullbacks CategoryTheory.Over.ConstructProducts.over_finiteProducts_of_finiteWidePullbacks
end ConstructProducts
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
has_limit F := HasLimit.mk
{ cone :=
{ pt := Over.mk (𝟙 _)
π :=
{ app := fun p => p.as.elim } }
isLimit :=
{ lift := fun s => Over.homMk _
fac := fun _ j => j.as.elim
uniq := fun s m _ => by
simp only
|
ext
|
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
has_limit F := HasLimit.mk
{ cone :=
{ pt := Over.mk (𝟙 _)
π :=
{ app := fun p => p.as.elim } }
isLimit :=
{ lift := fun s => Over.homMk _
fac := fun _ j => j.as.elim
uniq := fun s m _ => by
simp only
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.165_0.USyhUKjMzubPAtG
|
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
has_limit F
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
case h
J : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
F : Discrete PEmpty.{1} ⥤ Over B
s : Cone F
m : s.pt ⟶ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.pt
x✝ : ∀ (j : Discrete PEmpty.{1}), m ≫ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.π.app j = s.π.app j
⊢ m.left = (homMk s.pt.hom).left
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
· rw [Over.w, Category.id_comp]
· rw [Category.id_comp, Category.comp_id] }
#align category_theory.over.construct_products.cones_equiv_inverse_obj CategoryTheory.Over.ConstructProducts.conesEquivInverseObj
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
cases' j with j
· simp
· dsimp
rw [← f.w ⟨j⟩]
rfl }
#align category_theory.over.construct_products.cones_equiv_inverse CategoryTheory.Over.ConstructProducts.conesEquivInverse
-- Porting note: this should help with the additional `naturality` proof we now have to give in
-- `conesEquivFunctor`, but doesn't.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] Discrete
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivFunctor (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ⥤ Cone F where
obj c :=
{ pt := Over.mk (c.π.app none)
π :=
{ app := fun ⟨j⟩ => Over.homMk (c.π.app (some j)) (c.w (WidePullbackShape.Hom.term j))
-- Porting note: Added a proof for `naturality`
naturality := fun ⟨X⟩ ⟨Y⟩ ⟨⟨f⟩⟩ => by dsimp at f ⊢; aesop_cat } }
map f := { hom := Over.homMk f.hom }
#align category_theory.over.construct_products.cones_equiv_functor CategoryTheory.Over.ConstructProducts.conesEquivFunctor
-- Porting note: unfortunately `aesop` can't cope with a `cases` rule here for the type synonym
-- `WidePullbackShape`.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] WidePullbackShape
-- If this worked we could avoid the `rintro` in `conesEquivUnitIso`.
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivUnitIso (B : C) (F : Discrete J ⥤ Over B) :
𝟭 (Cone (widePullbackDiagramOfDiagramOver B F)) ≅
conesEquivFunctor B F ⋙ conesEquivInverse B F :=
NatIso.ofComponents fun _ => Cones.ext
{ hom := 𝟙 _
inv := 𝟙 _ }
(by rintro (j | j) <;> aesop_cat)
#align category_theory.over.construct_products.cones_equiv_unit_iso CategoryTheory.Over.ConstructProducts.conesEquivUnitIso
-- TODO: Can we add `:= by aesop` to the second arguments of `NatIso.ofComponents` and
-- `Cones.ext`?
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivCounitIso (B : C) (F : Discrete J ⥤ Over B) :
conesEquivInverse B F ⋙ conesEquivFunctor B F ≅ 𝟭 (Cone F) :=
NatIso.ofComponents fun _ => Cones.ext
{ hom := Over.homMk (𝟙 _)
inv := Over.homMk (𝟙 _) }
#align category_theory.over.construct_products.cones_equiv_counit_iso CategoryTheory.Over.ConstructProducts.conesEquivCounitIso
/-- (Impl) Establish an equivalence between the category of cones for `F` and for the "grown" `F`.
-/
@[simps]
def conesEquiv (B : C) (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ≌ Cone F where
functor := conesEquivFunctor B F
inverse := conesEquivInverse B F
unitIso := conesEquivUnitIso B F
counitIso := conesEquivCounitIso B F
#align category_theory.over.construct_products.cones_equiv CategoryTheory.Over.ConstructProducts.conesEquiv
/-- Use the above equivalence to prove we have a limit. -/
theorem has_over_limit_discrete_of_widePullback_limit {B : C} (F : Discrete J ⥤ Over B)
[HasLimit (widePullbackDiagramOfDiagramOver B F)] : HasLimit F :=
HasLimit.mk
{ cone := _
isLimit := IsLimit.ofRightAdjoint (conesEquiv B F).functor
(limit.isLimit (widePullbackDiagramOfDiagramOver B F)) }
#align category_theory.over.construct_products.has_over_limit_discrete_of_wide_pullback_limit CategoryTheory.Over.ConstructProducts.has_over_limit_discrete_of_widePullback_limit
/-- Given a wide pullback in `C`, construct a product in `C/B`. -/
theorem over_product_of_widePullback [HasLimitsOfShape (WidePullbackShape J) C] {B : C} :
HasLimitsOfShape (Discrete J) (Over B) :=
{ has_limit := fun F => has_over_limit_discrete_of_widePullback_limit F }
#align category_theory.over.construct_products.over_product_of_wide_pullback CategoryTheory.Over.ConstructProducts.over_product_of_widePullback
/-- Given a pullback in `C`, construct a binary product in `C/B`. -/
theorem over_binaryProduct_of_pullback [HasPullbacks C] {B : C} : HasBinaryProducts (Over B) :=
over_product_of_widePullback
#align category_theory.over.construct_products.over_binary_product_of_pullback CategoryTheory.Over.ConstructProducts.over_binaryProduct_of_pullback
/-- Given all wide pullbacks in `C`, construct products in `C/B`. -/
theorem over_products_of_widePullbacks [HasWidePullbacks.{w} C] {B : C} :
HasProducts.{w} (Over B) :=
fun _ => over_product_of_widePullback
#align category_theory.over.construct_products.over_products_of_wide_pullbacks CategoryTheory.Over.ConstructProducts.over_products_of_widePullbacks
/-- Given all finite wide pullbacks in `C`, construct finite products in `C/B`. -/
theorem over_finiteProducts_of_finiteWidePullbacks [HasFiniteWidePullbacks C] {B : C} :
HasFiniteProducts (Over B) :=
⟨fun _ => over_product_of_widePullback⟩
#align category_theory.over.construct_products.over_finite_products_of_finite_wide_pullbacks CategoryTheory.Over.ConstructProducts.over_finiteProducts_of_finiteWidePullbacks
end ConstructProducts
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
has_limit F := HasLimit.mk
{ cone :=
{ pt := Over.mk (𝟙 _)
π :=
{ app := fun p => p.as.elim } }
isLimit :=
{ lift := fun s => Over.homMk _
fac := fun _ j => j.as.elim
uniq := fun s m _ => by
simp only
ext
|
rw [Over.homMk_left _]
|
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
has_limit F := HasLimit.mk
{ cone :=
{ pt := Over.mk (𝟙 _)
π :=
{ app := fun p => p.as.elim } }
isLimit :=
{ lift := fun s => Over.homMk _
fac := fun _ j => j.as.elim
uniq := fun s m _ => by
simp only
ext
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.165_0.USyhUKjMzubPAtG
|
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
has_limit F
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
case h
J : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
F : Discrete PEmpty.{1} ⥤ Over B
s : Cone F
m : s.pt ⟶ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.pt
x✝ : ∀ (j : Discrete PEmpty.{1}), m ≫ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.π.app j = s.π.app j
⊢ m.left = s.pt.hom
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
· rw [Over.w, Category.id_comp]
· rw [Category.id_comp, Category.comp_id] }
#align category_theory.over.construct_products.cones_equiv_inverse_obj CategoryTheory.Over.ConstructProducts.conesEquivInverseObj
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
cases' j with j
· simp
· dsimp
rw [← f.w ⟨j⟩]
rfl }
#align category_theory.over.construct_products.cones_equiv_inverse CategoryTheory.Over.ConstructProducts.conesEquivInverse
-- Porting note: this should help with the additional `naturality` proof we now have to give in
-- `conesEquivFunctor`, but doesn't.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] Discrete
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivFunctor (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ⥤ Cone F where
obj c :=
{ pt := Over.mk (c.π.app none)
π :=
{ app := fun ⟨j⟩ => Over.homMk (c.π.app (some j)) (c.w (WidePullbackShape.Hom.term j))
-- Porting note: Added a proof for `naturality`
naturality := fun ⟨X⟩ ⟨Y⟩ ⟨⟨f⟩⟩ => by dsimp at f ⊢; aesop_cat } }
map f := { hom := Over.homMk f.hom }
#align category_theory.over.construct_products.cones_equiv_functor CategoryTheory.Over.ConstructProducts.conesEquivFunctor
-- Porting note: unfortunately `aesop` can't cope with a `cases` rule here for the type synonym
-- `WidePullbackShape`.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] WidePullbackShape
-- If this worked we could avoid the `rintro` in `conesEquivUnitIso`.
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivUnitIso (B : C) (F : Discrete J ⥤ Over B) :
𝟭 (Cone (widePullbackDiagramOfDiagramOver B F)) ≅
conesEquivFunctor B F ⋙ conesEquivInverse B F :=
NatIso.ofComponents fun _ => Cones.ext
{ hom := 𝟙 _
inv := 𝟙 _ }
(by rintro (j | j) <;> aesop_cat)
#align category_theory.over.construct_products.cones_equiv_unit_iso CategoryTheory.Over.ConstructProducts.conesEquivUnitIso
-- TODO: Can we add `:= by aesop` to the second arguments of `NatIso.ofComponents` and
-- `Cones.ext`?
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivCounitIso (B : C) (F : Discrete J ⥤ Over B) :
conesEquivInverse B F ⋙ conesEquivFunctor B F ≅ 𝟭 (Cone F) :=
NatIso.ofComponents fun _ => Cones.ext
{ hom := Over.homMk (𝟙 _)
inv := Over.homMk (𝟙 _) }
#align category_theory.over.construct_products.cones_equiv_counit_iso CategoryTheory.Over.ConstructProducts.conesEquivCounitIso
/-- (Impl) Establish an equivalence between the category of cones for `F` and for the "grown" `F`.
-/
@[simps]
def conesEquiv (B : C) (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ≌ Cone F where
functor := conesEquivFunctor B F
inverse := conesEquivInverse B F
unitIso := conesEquivUnitIso B F
counitIso := conesEquivCounitIso B F
#align category_theory.over.construct_products.cones_equiv CategoryTheory.Over.ConstructProducts.conesEquiv
/-- Use the above equivalence to prove we have a limit. -/
theorem has_over_limit_discrete_of_widePullback_limit {B : C} (F : Discrete J ⥤ Over B)
[HasLimit (widePullbackDiagramOfDiagramOver B F)] : HasLimit F :=
HasLimit.mk
{ cone := _
isLimit := IsLimit.ofRightAdjoint (conesEquiv B F).functor
(limit.isLimit (widePullbackDiagramOfDiagramOver B F)) }
#align category_theory.over.construct_products.has_over_limit_discrete_of_wide_pullback_limit CategoryTheory.Over.ConstructProducts.has_over_limit_discrete_of_widePullback_limit
/-- Given a wide pullback in `C`, construct a product in `C/B`. -/
theorem over_product_of_widePullback [HasLimitsOfShape (WidePullbackShape J) C] {B : C} :
HasLimitsOfShape (Discrete J) (Over B) :=
{ has_limit := fun F => has_over_limit_discrete_of_widePullback_limit F }
#align category_theory.over.construct_products.over_product_of_wide_pullback CategoryTheory.Over.ConstructProducts.over_product_of_widePullback
/-- Given a pullback in `C`, construct a binary product in `C/B`. -/
theorem over_binaryProduct_of_pullback [HasPullbacks C] {B : C} : HasBinaryProducts (Over B) :=
over_product_of_widePullback
#align category_theory.over.construct_products.over_binary_product_of_pullback CategoryTheory.Over.ConstructProducts.over_binaryProduct_of_pullback
/-- Given all wide pullbacks in `C`, construct products in `C/B`. -/
theorem over_products_of_widePullbacks [HasWidePullbacks.{w} C] {B : C} :
HasProducts.{w} (Over B) :=
fun _ => over_product_of_widePullback
#align category_theory.over.construct_products.over_products_of_wide_pullbacks CategoryTheory.Over.ConstructProducts.over_products_of_widePullbacks
/-- Given all finite wide pullbacks in `C`, construct finite products in `C/B`. -/
theorem over_finiteProducts_of_finiteWidePullbacks [HasFiniteWidePullbacks C] {B : C} :
HasFiniteProducts (Over B) :=
⟨fun _ => over_product_of_widePullback⟩
#align category_theory.over.construct_products.over_finite_products_of_finite_wide_pullbacks CategoryTheory.Over.ConstructProducts.over_finiteProducts_of_finiteWidePullbacks
end ConstructProducts
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
has_limit F := HasLimit.mk
{ cone :=
{ pt := Over.mk (𝟙 _)
π :=
{ app := fun p => p.as.elim } }
isLimit :=
{ lift := fun s => Over.homMk _
fac := fun _ j => j.as.elim
uniq := fun s m _ => by
simp only
ext
rw [Over.homMk_left _]
|
have := m.w
|
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
has_limit F := HasLimit.mk
{ cone :=
{ pt := Over.mk (𝟙 _)
π :=
{ app := fun p => p.as.elim } }
isLimit :=
{ lift := fun s => Over.homMk _
fac := fun _ j => j.as.elim
uniq := fun s m _ => by
simp only
ext
rw [Over.homMk_left _]
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.165_0.USyhUKjMzubPAtG
|
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
has_limit F
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
case h
J : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
F : Discrete PEmpty.{1} ⥤ Over B
s : Cone F
m : s.pt ⟶ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.pt
x✝ : ∀ (j : Discrete PEmpty.{1}), m ≫ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.π.app j = s.π.app j
this :
(𝟭 C).map m.left ≫ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.pt.hom =
s.pt.hom ≫ (Functor.fromPUnit B).map m.right
⊢ m.left = s.pt.hom
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
· rw [Over.w, Category.id_comp]
· rw [Category.id_comp, Category.comp_id] }
#align category_theory.over.construct_products.cones_equiv_inverse_obj CategoryTheory.Over.ConstructProducts.conesEquivInverseObj
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
cases' j with j
· simp
· dsimp
rw [← f.w ⟨j⟩]
rfl }
#align category_theory.over.construct_products.cones_equiv_inverse CategoryTheory.Over.ConstructProducts.conesEquivInverse
-- Porting note: this should help with the additional `naturality` proof we now have to give in
-- `conesEquivFunctor`, but doesn't.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] Discrete
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivFunctor (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ⥤ Cone F where
obj c :=
{ pt := Over.mk (c.π.app none)
π :=
{ app := fun ⟨j⟩ => Over.homMk (c.π.app (some j)) (c.w (WidePullbackShape.Hom.term j))
-- Porting note: Added a proof for `naturality`
naturality := fun ⟨X⟩ ⟨Y⟩ ⟨⟨f⟩⟩ => by dsimp at f ⊢; aesop_cat } }
map f := { hom := Over.homMk f.hom }
#align category_theory.over.construct_products.cones_equiv_functor CategoryTheory.Over.ConstructProducts.conesEquivFunctor
-- Porting note: unfortunately `aesop` can't cope with a `cases` rule here for the type synonym
-- `WidePullbackShape`.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] WidePullbackShape
-- If this worked we could avoid the `rintro` in `conesEquivUnitIso`.
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivUnitIso (B : C) (F : Discrete J ⥤ Over B) :
𝟭 (Cone (widePullbackDiagramOfDiagramOver B F)) ≅
conesEquivFunctor B F ⋙ conesEquivInverse B F :=
NatIso.ofComponents fun _ => Cones.ext
{ hom := 𝟙 _
inv := 𝟙 _ }
(by rintro (j | j) <;> aesop_cat)
#align category_theory.over.construct_products.cones_equiv_unit_iso CategoryTheory.Over.ConstructProducts.conesEquivUnitIso
-- TODO: Can we add `:= by aesop` to the second arguments of `NatIso.ofComponents` and
-- `Cones.ext`?
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivCounitIso (B : C) (F : Discrete J ⥤ Over B) :
conesEquivInverse B F ⋙ conesEquivFunctor B F ≅ 𝟭 (Cone F) :=
NatIso.ofComponents fun _ => Cones.ext
{ hom := Over.homMk (𝟙 _)
inv := Over.homMk (𝟙 _) }
#align category_theory.over.construct_products.cones_equiv_counit_iso CategoryTheory.Over.ConstructProducts.conesEquivCounitIso
/-- (Impl) Establish an equivalence between the category of cones for `F` and for the "grown" `F`.
-/
@[simps]
def conesEquiv (B : C) (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ≌ Cone F where
functor := conesEquivFunctor B F
inverse := conesEquivInverse B F
unitIso := conesEquivUnitIso B F
counitIso := conesEquivCounitIso B F
#align category_theory.over.construct_products.cones_equiv CategoryTheory.Over.ConstructProducts.conesEquiv
/-- Use the above equivalence to prove we have a limit. -/
theorem has_over_limit_discrete_of_widePullback_limit {B : C} (F : Discrete J ⥤ Over B)
[HasLimit (widePullbackDiagramOfDiagramOver B F)] : HasLimit F :=
HasLimit.mk
{ cone := _
isLimit := IsLimit.ofRightAdjoint (conesEquiv B F).functor
(limit.isLimit (widePullbackDiagramOfDiagramOver B F)) }
#align category_theory.over.construct_products.has_over_limit_discrete_of_wide_pullback_limit CategoryTheory.Over.ConstructProducts.has_over_limit_discrete_of_widePullback_limit
/-- Given a wide pullback in `C`, construct a product in `C/B`. -/
theorem over_product_of_widePullback [HasLimitsOfShape (WidePullbackShape J) C] {B : C} :
HasLimitsOfShape (Discrete J) (Over B) :=
{ has_limit := fun F => has_over_limit_discrete_of_widePullback_limit F }
#align category_theory.over.construct_products.over_product_of_wide_pullback CategoryTheory.Over.ConstructProducts.over_product_of_widePullback
/-- Given a pullback in `C`, construct a binary product in `C/B`. -/
theorem over_binaryProduct_of_pullback [HasPullbacks C] {B : C} : HasBinaryProducts (Over B) :=
over_product_of_widePullback
#align category_theory.over.construct_products.over_binary_product_of_pullback CategoryTheory.Over.ConstructProducts.over_binaryProduct_of_pullback
/-- Given all wide pullbacks in `C`, construct products in `C/B`. -/
theorem over_products_of_widePullbacks [HasWidePullbacks.{w} C] {B : C} :
HasProducts.{w} (Over B) :=
fun _ => over_product_of_widePullback
#align category_theory.over.construct_products.over_products_of_wide_pullbacks CategoryTheory.Over.ConstructProducts.over_products_of_widePullbacks
/-- Given all finite wide pullbacks in `C`, construct finite products in `C/B`. -/
theorem over_finiteProducts_of_finiteWidePullbacks [HasFiniteWidePullbacks C] {B : C} :
HasFiniteProducts (Over B) :=
⟨fun _ => over_product_of_widePullback⟩
#align category_theory.over.construct_products.over_finite_products_of_finite_wide_pullbacks CategoryTheory.Over.ConstructProducts.over_finiteProducts_of_finiteWidePullbacks
end ConstructProducts
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
has_limit F := HasLimit.mk
{ cone :=
{ pt := Over.mk (𝟙 _)
π :=
{ app := fun p => p.as.elim } }
isLimit :=
{ lift := fun s => Over.homMk _
fac := fun _ j => j.as.elim
uniq := fun s m _ => by
simp only
ext
rw [Over.homMk_left _]
have := m.w
|
dsimp at this
|
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
has_limit F := HasLimit.mk
{ cone :=
{ pt := Over.mk (𝟙 _)
π :=
{ app := fun p => p.as.elim } }
isLimit :=
{ lift := fun s => Over.homMk _
fac := fun _ j => j.as.elim
uniq := fun s m _ => by
simp only
ext
rw [Over.homMk_left _]
have := m.w
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.165_0.USyhUKjMzubPAtG
|
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
has_limit F
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
case h
J : Type w
C : Type u
inst✝ : Category.{v, u} C
X B : C
F : Discrete PEmpty.{1} ⥤ Over B
s : Cone F
m : s.pt ⟶ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.pt
x✝ : ∀ (j : Discrete PEmpty.{1}), m ≫ { pt := mk (𝟙 B), π := NatTrans.mk fun p => PEmpty.elim p.as }.π.app j = s.π.app j
this : m.left ≫ 𝟙 B = s.pt.hom ≫ 𝟙 B
⊢ m.left = s.pt.hom
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Reid Barton, Bhavik Mehta
-/
import Mathlib.CategoryTheory.Over
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Shapes.WidePullbacks
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
#align_import category_theory.limits.constructions.over.products from "leanprover-community/mathlib"@"ac3ae212f394f508df43e37aa093722fa9b65d31"
/-!
# Products in the over category
Shows that products in the over category can be derived from wide pullbacks in the base category.
The main result is `over_product_of_widePullback`, which says that if `C` has `J`-indexed wide
pullbacks, then `Over B` has `J`-indexed products.
-/
universe w v u -- morphism levels before object levels. See note [category_theory universes].
open CategoryTheory CategoryTheory.Limits
variable {J : Type w}
variable {C : Type u} [Category.{v} C]
variable {X : C}
namespace CategoryTheory.Over
namespace ConstructProducts
/-- (Implementation)
Given a product diagram in `C/B`, construct the corresponding wide pullback diagram
in `C`.
-/
@[reducible]
def widePullbackDiagramOfDiagramOver (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
WidePullbackShape J ⥤ C :=
WidePullbackShape.wideCospan B (fun j => (F.obj ⟨j⟩).left) fun j => (F.obj ⟨j⟩).hom
#align category_theory.over.construct_products.wide_pullback_diagram_of_diagram_over CategoryTheory.Over.ConstructProducts.widePullbackDiagramOfDiagramOver
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverseObj (B : C) {J : Type w} (F : Discrete J ⥤ Over B) (c : Cone F) :
Cone (widePullbackDiagramOfDiagramOver B F) where
pt := c.pt.left
π :=
{ app := fun X => Option.casesOn X c.pt.hom fun j : J => (c.π.app ⟨j⟩).left
-- `tidy` can do this using `case_bash`, but let's try to be a good `-T50000` citizen:
naturality := fun X Y f => by
dsimp; cases X <;> cases Y <;> cases f
· rw [Category.id_comp, Category.comp_id]
· rw [Over.w, Category.id_comp]
· rw [Category.id_comp, Category.comp_id] }
#align category_theory.over.construct_products.cones_equiv_inverse_obj CategoryTheory.Over.ConstructProducts.conesEquivInverseObj
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivInverse (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone F ⥤ Cone (widePullbackDiagramOfDiagramOver B F) where
obj := conesEquivInverseObj B F
map f :=
{ hom := f.hom.left
w := fun j => by
cases' j with j
· simp
· dsimp
rw [← f.w ⟨j⟩]
rfl }
#align category_theory.over.construct_products.cones_equiv_inverse CategoryTheory.Over.ConstructProducts.conesEquivInverse
-- Porting note: this should help with the additional `naturality` proof we now have to give in
-- `conesEquivFunctor`, but doesn't.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] Discrete
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simps]
def conesEquivFunctor (B : C) {J : Type w} (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ⥤ Cone F where
obj c :=
{ pt := Over.mk (c.π.app none)
π :=
{ app := fun ⟨j⟩ => Over.homMk (c.π.app (some j)) (c.w (WidePullbackShape.Hom.term j))
-- Porting note: Added a proof for `naturality`
naturality := fun ⟨X⟩ ⟨Y⟩ ⟨⟨f⟩⟩ => by dsimp at f ⊢; aesop_cat } }
map f := { hom := Over.homMk f.hom }
#align category_theory.over.construct_products.cones_equiv_functor CategoryTheory.Over.ConstructProducts.conesEquivFunctor
-- Porting note: unfortunately `aesop` can't cope with a `cases` rule here for the type synonym
-- `WidePullbackShape`.
-- attribute [local aesop safe cases (rule_sets [CategoryTheory])] WidePullbackShape
-- If this worked we could avoid the `rintro` in `conesEquivUnitIso`.
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivUnitIso (B : C) (F : Discrete J ⥤ Over B) :
𝟭 (Cone (widePullbackDiagramOfDiagramOver B F)) ≅
conesEquivFunctor B F ⋙ conesEquivInverse B F :=
NatIso.ofComponents fun _ => Cones.ext
{ hom := 𝟙 _
inv := 𝟙 _ }
(by rintro (j | j) <;> aesop_cat)
#align category_theory.over.construct_products.cones_equiv_unit_iso CategoryTheory.Over.ConstructProducts.conesEquivUnitIso
-- TODO: Can we add `:= by aesop` to the second arguments of `NatIso.ofComponents` and
-- `Cones.ext`?
/-- (Impl) A preliminary definition to avoid timeouts. -/
@[simp]
def conesEquivCounitIso (B : C) (F : Discrete J ⥤ Over B) :
conesEquivInverse B F ⋙ conesEquivFunctor B F ≅ 𝟭 (Cone F) :=
NatIso.ofComponents fun _ => Cones.ext
{ hom := Over.homMk (𝟙 _)
inv := Over.homMk (𝟙 _) }
#align category_theory.over.construct_products.cones_equiv_counit_iso CategoryTheory.Over.ConstructProducts.conesEquivCounitIso
/-- (Impl) Establish an equivalence between the category of cones for `F` and for the "grown" `F`.
-/
@[simps]
def conesEquiv (B : C) (F : Discrete J ⥤ Over B) :
Cone (widePullbackDiagramOfDiagramOver B F) ≌ Cone F where
functor := conesEquivFunctor B F
inverse := conesEquivInverse B F
unitIso := conesEquivUnitIso B F
counitIso := conesEquivCounitIso B F
#align category_theory.over.construct_products.cones_equiv CategoryTheory.Over.ConstructProducts.conesEquiv
/-- Use the above equivalence to prove we have a limit. -/
theorem has_over_limit_discrete_of_widePullback_limit {B : C} (F : Discrete J ⥤ Over B)
[HasLimit (widePullbackDiagramOfDiagramOver B F)] : HasLimit F :=
HasLimit.mk
{ cone := _
isLimit := IsLimit.ofRightAdjoint (conesEquiv B F).functor
(limit.isLimit (widePullbackDiagramOfDiagramOver B F)) }
#align category_theory.over.construct_products.has_over_limit_discrete_of_wide_pullback_limit CategoryTheory.Over.ConstructProducts.has_over_limit_discrete_of_widePullback_limit
/-- Given a wide pullback in `C`, construct a product in `C/B`. -/
theorem over_product_of_widePullback [HasLimitsOfShape (WidePullbackShape J) C] {B : C} :
HasLimitsOfShape (Discrete J) (Over B) :=
{ has_limit := fun F => has_over_limit_discrete_of_widePullback_limit F }
#align category_theory.over.construct_products.over_product_of_wide_pullback CategoryTheory.Over.ConstructProducts.over_product_of_widePullback
/-- Given a pullback in `C`, construct a binary product in `C/B`. -/
theorem over_binaryProduct_of_pullback [HasPullbacks C] {B : C} : HasBinaryProducts (Over B) :=
over_product_of_widePullback
#align category_theory.over.construct_products.over_binary_product_of_pullback CategoryTheory.Over.ConstructProducts.over_binaryProduct_of_pullback
/-- Given all wide pullbacks in `C`, construct products in `C/B`. -/
theorem over_products_of_widePullbacks [HasWidePullbacks.{w} C] {B : C} :
HasProducts.{w} (Over B) :=
fun _ => over_product_of_widePullback
#align category_theory.over.construct_products.over_products_of_wide_pullbacks CategoryTheory.Over.ConstructProducts.over_products_of_widePullbacks
/-- Given all finite wide pullbacks in `C`, construct finite products in `C/B`. -/
theorem over_finiteProducts_of_finiteWidePullbacks [HasFiniteWidePullbacks C] {B : C} :
HasFiniteProducts (Over B) :=
⟨fun _ => over_product_of_widePullback⟩
#align category_theory.over.construct_products.over_finite_products_of_finite_wide_pullbacks CategoryTheory.Over.ConstructProducts.over_finiteProducts_of_finiteWidePullbacks
end ConstructProducts
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
has_limit F := HasLimit.mk
{ cone :=
{ pt := Over.mk (𝟙 _)
π :=
{ app := fun p => p.as.elim } }
isLimit :=
{ lift := fun s => Over.homMk _
fac := fun _ j => j.as.elim
uniq := fun s m _ => by
simp only
ext
rw [Over.homMk_left _]
have := m.w
dsimp at this
|
rwa [Category.comp_id, Category.comp_id] at this
|
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
has_limit F := HasLimit.mk
{ cone :=
{ pt := Over.mk (𝟙 _)
π :=
{ app := fun p => p.as.elim } }
isLimit :=
{ lift := fun s => Over.homMk _
fac := fun _ j => j.as.elim
uniq := fun s m _ => by
simp only
ext
rw [Over.homMk_left _]
have := m.w
dsimp at this
|
Mathlib.CategoryTheory.Limits.Constructions.Over.Products.165_0.USyhUKjMzubPAtG
|
/-- Construct terminal object in the over category. This isn't an instance as it's not typically the
way we want to define terminal objects.
(For instance, this gives a terminal object which is different from the generic one given by
`over_product_of_widePullback` above.)
-/
theorem over_hasTerminal (B : C) : HasTerminal (Over B) where
has_limit F
|
Mathlib_CategoryTheory_Limits_Constructions_Over_Products
|
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
U : (Opens ↑X)ᵒᵖ
⊢ { obj := fun U => CommRingCat.of (Localization (obj G U)),
map := fun {U V} i =>
CommRingCat.ofHom
(IsLocalization.map (Localization (obj G V)) (F.map i)
(_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V))) }.map
(𝟙 U) =
𝟙
({ obj := fun U => CommRingCat.of (Localization (obj G U)),
map := fun {U V} i =>
CommRingCat.ofHom
(IsLocalization.map (Localization (obj G V)) (F.map i)
(_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V))) }.obj
U)
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
|
simp_rw [F.map_id]
|
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
|
Mathlib.Topology.Sheaves.Operations.51_0.VAfusCW1hNuysqq
|
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U
|
Mathlib_Topology_Sheaves_Operations
|
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
U : (Opens ↑X)ᵒᵖ
⊢ CommRingCat.ofHom
(IsLocalization.map (Localization (obj G U)) (𝟙 (F.obj U))
(_ : obj G U ≤ Submonoid.comap (𝟙 (F.obj U)) (obj G U))) =
𝟙 (CommRingCat.of (Localization (obj G U)))
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
|
ext x
|
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
|
Mathlib.Topology.Sheaves.Operations.51_0.VAfusCW1hNuysqq
|
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U
|
Mathlib_Topology_Sheaves_Operations
|
case w
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
U : (Opens ↑X)ᵒᵖ
x : (forget CommRingCat).obj (CommRingCat.of (Localization (obj G U)))
⊢ (CommRingCat.ofHom
(IsLocalization.map (Localization (obj G U)) (𝟙 (F.obj U))
(_ : obj G U ≤ Submonoid.comap (𝟙 (F.obj U)) (obj G U))))
x =
(𝟙 (CommRingCat.of (Localization (obj G U)))) x
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
|
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
|
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
|
Mathlib.Topology.Sheaves.Operations.51_0.VAfusCW1hNuysqq
|
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U
|
Mathlib_Topology_Sheaves_Operations
|
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
U V W : (Opens ↑X)ᵒᵖ
i : U ⟶ V
j : V ⟶ W
⊢ { obj := fun U => CommRingCat.of (Localization (obj G U)),
map := fun {U V} i =>
CommRingCat.ofHom
(IsLocalization.map (Localization (obj G V)) (F.map i)
(_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V))) }.map
(i ≫ j) =
{ obj := fun U => CommRingCat.of (Localization (obj G U)),
map := fun {U V} i =>
CommRingCat.ofHom
(IsLocalization.map (Localization (obj G V)) (F.map i)
(_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V))) }.map
i ≫
{ obj := fun U => CommRingCat.of (Localization (obj G U)),
map := fun {U V} i =>
CommRingCat.ofHom
(IsLocalization.map (Localization (obj G V)) (F.map i)
(_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V))) }.map
j
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
|
delta CommRingCat.ofHom CommRingCat.of Bundled.of
|
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
|
Mathlib.Topology.Sheaves.Operations.51_0.VAfusCW1hNuysqq
|
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U
|
Mathlib_Topology_Sheaves_Operations
|
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
U V W : (Opens ↑X)ᵒᵖ
i : U ⟶ V
j : V ⟶ W
⊢ { obj := fun U => Bundled.mk (Localization (obj G U)),
map := fun {U V} i =>
IsLocalization.map (Localization (obj G V)) (F.map i)
(_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V)) }.map
(i ≫ j) =
{ obj := fun U => Bundled.mk (Localization (obj G U)),
map := fun {U V} i =>
IsLocalization.map (Localization (obj G V)) (F.map i)
(_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V)) }.map
i ≫
{ obj := fun U => Bundled.mk (Localization (obj G U)),
map := fun {U V} i =>
IsLocalization.map (Localization (obj G V)) (F.map i)
(_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V)) }.map
j
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
|
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
|
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
|
Mathlib.Topology.Sheaves.Operations.51_0.VAfusCW1hNuysqq
|
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U
|
Mathlib_Topology_Sheaves_Operations
|
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
U V W : (Opens ↑X)ᵒᵖ
i : U ⟶ V
j : V ⟶ W
⊢ IsLocalization.map (Localization (obj G W)) (RingHom.comp (F.map j) (F.map i))
(_ : obj G U ≤ Submonoid.comap (RingHom.comp (F.map j) (F.map i)) (obj G W)) =
RingHom.comp
(IsLocalization.map (Localization (obj G W)) (F.map j) (_ : obj G V ≤ Submonoid.comap (F.map j) (obj G W)))
(IsLocalization.map (Localization (obj G V)) (F.map i) (_ : obj G U ≤ Submonoid.comap (F.map i) (obj G V)))
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
|
rw [IsLocalization.map_comp_map]
|
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
|
Mathlib.Topology.Sheaves.Operations.51_0.VAfusCW1hNuysqq
|
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U
|
Mathlib_Topology_Sheaves_Operations
|
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
S : (x : ↑X) → Submonoid ↑(stalk F x)
U V : (Opens ↑X)ᵒᵖ
i : U ⟶ V
⊢ (fun U => ⨅ x, Submonoid.comap (germ F x) (S ↑x)) U ≤
Submonoid.comap (F.map i) ((fun U => ⨅ x, Submonoid.comap (germ F x) (S ↑x)) V)
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
|
intro s hs
|
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
|
Mathlib.Topology.Sheaves.Operations.86_0.VAfusCW1hNuysqq
|
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U
|
Mathlib_Topology_Sheaves_Operations
|
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
S : (x : ↑X) → Submonoid ↑(stalk F x)
U V : (Opens ↑X)ᵒᵖ
i : U ⟶ V
s : (forget CommRingCat).obj (F.obj U)
hs : s ∈ (fun U => ⨅ x, Submonoid.comap (germ F x) (S ↑x)) U
⊢ s ∈ Submonoid.comap (F.map i) ((fun U => ⨅ x, Submonoid.comap (germ F x) (S ↑x)) V)
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
|
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
|
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
|
Mathlib.Topology.Sheaves.Operations.86_0.VAfusCW1hNuysqq
|
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U
|
Mathlib_Topology_Sheaves_Operations
|
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
S : (x : ↑X) → Submonoid ↑(stalk F x)
U V : (Opens ↑X)ᵒᵖ
i : U ⟶ V
s : (forget CommRingCat).obj (F.obj U)
hs : ∀ (i : ↥U.unop), (germ F i) s ∈ S ↑i
⊢ ∀ (i_1 : ↥V.unop), (germ F i_1) ((F.map i) s) ∈ S ↑i_1
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
|
intro x
|
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
|
Mathlib.Topology.Sheaves.Operations.86_0.VAfusCW1hNuysqq
|
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U
|
Mathlib_Topology_Sheaves_Operations
|
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
S : (x : ↑X) → Submonoid ↑(stalk F x)
U V : (Opens ↑X)ᵒᵖ
i : U ⟶ V
s : (forget CommRingCat).obj (F.obj U)
hs : ∀ (i : ↥U.unop), (germ F i) s ∈ S ↑i
x : ↥V.unop
⊢ (germ F x) ((F.map i) s) ∈ S ↑x
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
|
change (F.map i.unop.op ≫ F.germ x) s ∈ _
|
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
|
Mathlib.Topology.Sheaves.Operations.86_0.VAfusCW1hNuysqq
|
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U
|
Mathlib_Topology_Sheaves_Operations
|
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
S : (x : ↑X) → Submonoid ↑(stalk F x)
U V : (Opens ↑X)ᵒᵖ
i : U ⟶ V
s : (forget CommRingCat).obj (F.obj U)
hs : ∀ (i : ↥U.unop), (germ F i) s ∈ S ↑i
x : ↥V.unop
⊢ (F.map i.unop.op ≫ germ F x) s ∈ S ↑x
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
|
rw [F.germ_res]
|
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
|
Mathlib.Topology.Sheaves.Operations.86_0.VAfusCW1hNuysqq
|
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U
|
Mathlib_Topology_Sheaves_Operations
|
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F : Presheaf CommRingCat X
G : SubmonoidPresheaf F
S : (x : ↑X) → Submonoid ↑(stalk F x)
U V : (Opens ↑X)ᵒᵖ
i : U ⟶ V
s : (forget CommRingCat).obj (F.obj U)
hs : ∀ (i : ↥U.unop), (germ F i) s ∈ S ↑i
x : ↥V.unop
⊢ (germ F ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U.unop) }) x)) s ∈ S ↑x
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
rw [F.germ_res]
|
exact hs _
|
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
rw [F.germ_res]
|
Mathlib.Topology.Sheaves.Operations.86_0.VAfusCW1hNuysqq
|
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U
|
Mathlib_Topology_Sheaves_Operations
|
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
⊢ Mono (toTotalQuotientPresheaf (Sheaf.presheaf F))
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
rw [F.germ_res]
exact hs _
#align Top.presheaf.submonoid_presheaf_of_stalk TopCat.Presheaf.submonoidPresheafOfStalk
noncomputable instance : Inhabited F.SubmonoidPresheaf :=
⟨F.submonoidPresheafOfStalk fun _ => ⊥⟩
/-- The localization of a presheaf of `CommRing`s at locally non-zero-divisor sections. -/
noncomputable def totalQuotientPresheaf : X.Presheaf CommRingCat.{w} :=
(F.submonoidPresheafOfStalk fun x => (F.stalk x)⁰).localizationPresheaf
#align Top.presheaf.total_quotient_presheaf TopCat.Presheaf.totalQuotientPresheaf
/-- The map into the presheaf of total quotient rings -/
noncomputable def toTotalQuotientPresheaf : F ⟶ F.totalQuotientPresheaf :=
SubmonoidPresheaf.toLocalizationPresheaf _
#align Top.presheaf.to_total_quotient_presheaf TopCat.Presheaf.toTotalQuotientPresheaf
-- Porting note : deriving `Epi` failed
instance : Epi (toTotalQuotientPresheaf F) := epi_toLocalizationPresheaf _
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
|
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
|
Mathlib.Topology.Sheaves.Operations.117_0.VAfusCW1hNuysqq
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf
|
Mathlib_Topology_Sheaves_Operations
|
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
this : ∀ (U : (Opens ↑X)ᵒᵖ), Mono ((toTotalQuotientPresheaf (Sheaf.presheaf F)).app U)
⊢ Mono (toTotalQuotientPresheaf (Sheaf.presheaf F))
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
rw [F.germ_res]
exact hs _
#align Top.presheaf.submonoid_presheaf_of_stalk TopCat.Presheaf.submonoidPresheafOfStalk
noncomputable instance : Inhabited F.SubmonoidPresheaf :=
⟨F.submonoidPresheafOfStalk fun _ => ⊥⟩
/-- The localization of a presheaf of `CommRing`s at locally non-zero-divisor sections. -/
noncomputable def totalQuotientPresheaf : X.Presheaf CommRingCat.{w} :=
(F.submonoidPresheafOfStalk fun x => (F.stalk x)⁰).localizationPresheaf
#align Top.presheaf.total_quotient_presheaf TopCat.Presheaf.totalQuotientPresheaf
/-- The map into the presheaf of total quotient rings -/
noncomputable def toTotalQuotientPresheaf : F ⟶ F.totalQuotientPresheaf :=
SubmonoidPresheaf.toLocalizationPresheaf _
#align Top.presheaf.to_total_quotient_presheaf TopCat.Presheaf.toTotalQuotientPresheaf
-- Porting note : deriving `Epi` failed
instance : Epi (toTotalQuotientPresheaf F) := epi_toLocalizationPresheaf _
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
·
|
apply NatTrans.mono_of_mono_app
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
·
|
Mathlib.Topology.Sheaves.Operations.117_0.VAfusCW1hNuysqq
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf
|
Mathlib_Topology_Sheaves_Operations
|
case this
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
⊢ ∀ (U : (Opens ↑X)ᵒᵖ), Mono ((toTotalQuotientPresheaf (Sheaf.presheaf F)).app U)
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
rw [F.germ_res]
exact hs _
#align Top.presheaf.submonoid_presheaf_of_stalk TopCat.Presheaf.submonoidPresheafOfStalk
noncomputable instance : Inhabited F.SubmonoidPresheaf :=
⟨F.submonoidPresheafOfStalk fun _ => ⊥⟩
/-- The localization of a presheaf of `CommRing`s at locally non-zero-divisor sections. -/
noncomputable def totalQuotientPresheaf : X.Presheaf CommRingCat.{w} :=
(F.submonoidPresheafOfStalk fun x => (F.stalk x)⁰).localizationPresheaf
#align Top.presheaf.total_quotient_presheaf TopCat.Presheaf.totalQuotientPresheaf
/-- The map into the presheaf of total quotient rings -/
noncomputable def toTotalQuotientPresheaf : F ⟶ F.totalQuotientPresheaf :=
SubmonoidPresheaf.toLocalizationPresheaf _
#align Top.presheaf.to_total_quotient_presheaf TopCat.Presheaf.toTotalQuotientPresheaf
-- Porting note : deriving `Epi` failed
instance : Epi (toTotalQuotientPresheaf F) := epi_toLocalizationPresheaf _
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
|
intro U
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
|
Mathlib.Topology.Sheaves.Operations.117_0.VAfusCW1hNuysqq
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf
|
Mathlib_Topology_Sheaves_Operations
|
case this
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
⊢ Mono ((toTotalQuotientPresheaf (Sheaf.presheaf F)).app U)
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
rw [F.germ_res]
exact hs _
#align Top.presheaf.submonoid_presheaf_of_stalk TopCat.Presheaf.submonoidPresheafOfStalk
noncomputable instance : Inhabited F.SubmonoidPresheaf :=
⟨F.submonoidPresheafOfStalk fun _ => ⊥⟩
/-- The localization of a presheaf of `CommRing`s at locally non-zero-divisor sections. -/
noncomputable def totalQuotientPresheaf : X.Presheaf CommRingCat.{w} :=
(F.submonoidPresheafOfStalk fun x => (F.stalk x)⁰).localizationPresheaf
#align Top.presheaf.total_quotient_presheaf TopCat.Presheaf.totalQuotientPresheaf
/-- The map into the presheaf of total quotient rings -/
noncomputable def toTotalQuotientPresheaf : F ⟶ F.totalQuotientPresheaf :=
SubmonoidPresheaf.toLocalizationPresheaf _
#align Top.presheaf.to_total_quotient_presheaf TopCat.Presheaf.toTotalQuotientPresheaf
-- Porting note : deriving `Epi` failed
instance : Epi (toTotalQuotientPresheaf F) := epi_toLocalizationPresheaf _
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
|
apply ConcreteCategory.mono_of_injective
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
|
Mathlib.Topology.Sheaves.Operations.117_0.VAfusCW1hNuysqq
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf
|
Mathlib_Topology_Sheaves_Operations
|
case this.i
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
⊢ Function.Injective ⇑((toTotalQuotientPresheaf (Sheaf.presheaf F)).app U)
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
rw [F.germ_res]
exact hs _
#align Top.presheaf.submonoid_presheaf_of_stalk TopCat.Presheaf.submonoidPresheafOfStalk
noncomputable instance : Inhabited F.SubmonoidPresheaf :=
⟨F.submonoidPresheafOfStalk fun _ => ⊥⟩
/-- The localization of a presheaf of `CommRing`s at locally non-zero-divisor sections. -/
noncomputable def totalQuotientPresheaf : X.Presheaf CommRingCat.{w} :=
(F.submonoidPresheafOfStalk fun x => (F.stalk x)⁰).localizationPresheaf
#align Top.presheaf.total_quotient_presheaf TopCat.Presheaf.totalQuotientPresheaf
/-- The map into the presheaf of total quotient rings -/
noncomputable def toTotalQuotientPresheaf : F ⟶ F.totalQuotientPresheaf :=
SubmonoidPresheaf.toLocalizationPresheaf _
#align Top.presheaf.to_total_quotient_presheaf TopCat.Presheaf.toTotalQuotientPresheaf
-- Porting note : deriving `Epi` failed
instance : Epi (toTotalQuotientPresheaf F) := epi_toLocalizationPresheaf _
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
|
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
|
Mathlib.Topology.Sheaves.Operations.117_0.VAfusCW1hNuysqq
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf
|
Mathlib_Topology_Sheaves_Operations
|
case this.i
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
⊢ Function.Injective
⇑(algebraMap (↑((Sheaf.presheaf F).obj U))
(Localization (⨅ x, Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰)))
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
rw [F.germ_res]
exact hs _
#align Top.presheaf.submonoid_presheaf_of_stalk TopCat.Presheaf.submonoidPresheafOfStalk
noncomputable instance : Inhabited F.SubmonoidPresheaf :=
⟨F.submonoidPresheafOfStalk fun _ => ⊥⟩
/-- The localization of a presheaf of `CommRing`s at locally non-zero-divisor sections. -/
noncomputable def totalQuotientPresheaf : X.Presheaf CommRingCat.{w} :=
(F.submonoidPresheafOfStalk fun x => (F.stalk x)⁰).localizationPresheaf
#align Top.presheaf.total_quotient_presheaf TopCat.Presheaf.totalQuotientPresheaf
/-- The map into the presheaf of total quotient rings -/
noncomputable def toTotalQuotientPresheaf : F ⟶ F.totalQuotientPresheaf :=
SubmonoidPresheaf.toLocalizationPresheaf _
#align Top.presheaf.to_total_quotient_presheaf TopCat.Presheaf.toTotalQuotientPresheaf
-- Porting note : deriving `Epi` failed
instance : Epi (toTotalQuotientPresheaf F) := epi_toLocalizationPresheaf _
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
|
set m := _
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
|
Mathlib.Topology.Sheaves.Operations.117_0.VAfusCW1hNuysqq
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf
|
Mathlib_Topology_Sheaves_Operations
|
case this.i
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : ?m.64484 := ?m.64485
⊢ Function.Injective
⇑(algebraMap (↑((Sheaf.presheaf F).obj U))
(Localization (⨅ x, Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰)))
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
rw [F.germ_res]
exact hs _
#align Top.presheaf.submonoid_presheaf_of_stalk TopCat.Presheaf.submonoidPresheafOfStalk
noncomputable instance : Inhabited F.SubmonoidPresheaf :=
⟨F.submonoidPresheafOfStalk fun _ => ⊥⟩
/-- The localization of a presheaf of `CommRing`s at locally non-zero-divisor sections. -/
noncomputable def totalQuotientPresheaf : X.Presheaf CommRingCat.{w} :=
(F.submonoidPresheafOfStalk fun x => (F.stalk x)⁰).localizationPresheaf
#align Top.presheaf.total_quotient_presheaf TopCat.Presheaf.totalQuotientPresheaf
/-- The map into the presheaf of total quotient rings -/
noncomputable def toTotalQuotientPresheaf : F ⟶ F.totalQuotientPresheaf :=
SubmonoidPresheaf.toLocalizationPresheaf _
#align Top.presheaf.to_total_quotient_presheaf TopCat.Presheaf.toTotalQuotientPresheaf
-- Porting note : deriving `Epi` failed
instance : Epi (toTotalQuotientPresheaf F) := epi_toLocalizationPresheaf _
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
|
change Function.Injective (algebraMap _ (Localization m))
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
|
Mathlib.Topology.Sheaves.Operations.117_0.VAfusCW1hNuysqq
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf
|
Mathlib_Topology_Sheaves_Operations
|
case this.i
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ x, Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
⊢ Function.Injective ⇑(algebraMap ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) (Localization m))
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
rw [F.germ_res]
exact hs _
#align Top.presheaf.submonoid_presheaf_of_stalk TopCat.Presheaf.submonoidPresheafOfStalk
noncomputable instance : Inhabited F.SubmonoidPresheaf :=
⟨F.submonoidPresheafOfStalk fun _ => ⊥⟩
/-- The localization of a presheaf of `CommRing`s at locally non-zero-divisor sections. -/
noncomputable def totalQuotientPresheaf : X.Presheaf CommRingCat.{w} :=
(F.submonoidPresheafOfStalk fun x => (F.stalk x)⁰).localizationPresheaf
#align Top.presheaf.total_quotient_presheaf TopCat.Presheaf.totalQuotientPresheaf
/-- The map into the presheaf of total quotient rings -/
noncomputable def toTotalQuotientPresheaf : F ⟶ F.totalQuotientPresheaf :=
SubmonoidPresheaf.toLocalizationPresheaf _
#align Top.presheaf.to_total_quotient_presheaf TopCat.Presheaf.toTotalQuotientPresheaf
-- Porting note : deriving `Epi` failed
instance : Epi (toTotalQuotientPresheaf F) := epi_toLocalizationPresheaf _
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
|
change Function.Injective (algebraMap (F.presheaf.obj U) _)
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
|
Mathlib.Topology.Sheaves.Operations.117_0.VAfusCW1hNuysqq
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf
|
Mathlib_Topology_Sheaves_Operations
|
case this.i
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ x, Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
⊢ Function.Injective ⇑(algebraMap (↑((Sheaf.presheaf F).obj U)) (Localization m))
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
rw [F.germ_res]
exact hs _
#align Top.presheaf.submonoid_presheaf_of_stalk TopCat.Presheaf.submonoidPresheafOfStalk
noncomputable instance : Inhabited F.SubmonoidPresheaf :=
⟨F.submonoidPresheafOfStalk fun _ => ⊥⟩
/-- The localization of a presheaf of `CommRing`s at locally non-zero-divisor sections. -/
noncomputable def totalQuotientPresheaf : X.Presheaf CommRingCat.{w} :=
(F.submonoidPresheafOfStalk fun x => (F.stalk x)⁰).localizationPresheaf
#align Top.presheaf.total_quotient_presheaf TopCat.Presheaf.totalQuotientPresheaf
/-- The map into the presheaf of total quotient rings -/
noncomputable def toTotalQuotientPresheaf : F ⟶ F.totalQuotientPresheaf :=
SubmonoidPresheaf.toLocalizationPresheaf _
#align Top.presheaf.to_total_quotient_presheaf TopCat.Presheaf.toTotalQuotientPresheaf
-- Porting note : deriving `Epi` failed
instance : Epi (toTotalQuotientPresheaf F) := epi_toLocalizationPresheaf _
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
change Function.Injective (algebraMap (F.presheaf.obj U) _)
|
haveI : IsLocalization _ (Localization m) := Localization.isLocalization
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
change Function.Injective (algebraMap (F.presheaf.obj U) _)
|
Mathlib.Topology.Sheaves.Operations.117_0.VAfusCW1hNuysqq
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf
|
Mathlib_Topology_Sheaves_Operations
|
case this.i
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ x, Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
this : IsLocalization m (Localization m)
⊢ Function.Injective ⇑(algebraMap (↑((Sheaf.presheaf F).obj U)) (Localization m))
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
rw [F.germ_res]
exact hs _
#align Top.presheaf.submonoid_presheaf_of_stalk TopCat.Presheaf.submonoidPresheafOfStalk
noncomputable instance : Inhabited F.SubmonoidPresheaf :=
⟨F.submonoidPresheafOfStalk fun _ => ⊥⟩
/-- The localization of a presheaf of `CommRing`s at locally non-zero-divisor sections. -/
noncomputable def totalQuotientPresheaf : X.Presheaf CommRingCat.{w} :=
(F.submonoidPresheafOfStalk fun x => (F.stalk x)⁰).localizationPresheaf
#align Top.presheaf.total_quotient_presheaf TopCat.Presheaf.totalQuotientPresheaf
/-- The map into the presheaf of total quotient rings -/
noncomputable def toTotalQuotientPresheaf : F ⟶ F.totalQuotientPresheaf :=
SubmonoidPresheaf.toLocalizationPresheaf _
#align Top.presheaf.to_total_quotient_presheaf TopCat.Presheaf.toTotalQuotientPresheaf
-- Porting note : deriving `Epi` failed
instance : Epi (toTotalQuotientPresheaf F) := epi_toLocalizationPresheaf _
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
change Function.Injective (algebraMap (F.presheaf.obj U) _)
haveI : IsLocalization _ (Localization m) := Localization.isLocalization
-- Porting note : `M` and `S` need to be specified manually, so used a hack to save some typing
|
refine IsLocalization.injective (M := m) (S := Localization m) ?_
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
change Function.Injective (algebraMap (F.presheaf.obj U) _)
haveI : IsLocalization _ (Localization m) := Localization.isLocalization
-- Porting note : `M` and `S` need to be specified manually, so used a hack to save some typing
|
Mathlib.Topology.Sheaves.Operations.117_0.VAfusCW1hNuysqq
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf
|
Mathlib_Topology_Sheaves_Operations
|
case this.i
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ x, Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
this : IsLocalization m (Localization m)
⊢ m ≤ ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U))⁰
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
rw [F.germ_res]
exact hs _
#align Top.presheaf.submonoid_presheaf_of_stalk TopCat.Presheaf.submonoidPresheafOfStalk
noncomputable instance : Inhabited F.SubmonoidPresheaf :=
⟨F.submonoidPresheafOfStalk fun _ => ⊥⟩
/-- The localization of a presheaf of `CommRing`s at locally non-zero-divisor sections. -/
noncomputable def totalQuotientPresheaf : X.Presheaf CommRingCat.{w} :=
(F.submonoidPresheafOfStalk fun x => (F.stalk x)⁰).localizationPresheaf
#align Top.presheaf.total_quotient_presheaf TopCat.Presheaf.totalQuotientPresheaf
/-- The map into the presheaf of total quotient rings -/
noncomputable def toTotalQuotientPresheaf : F ⟶ F.totalQuotientPresheaf :=
SubmonoidPresheaf.toLocalizationPresheaf _
#align Top.presheaf.to_total_quotient_presheaf TopCat.Presheaf.toTotalQuotientPresheaf
-- Porting note : deriving `Epi` failed
instance : Epi (toTotalQuotientPresheaf F) := epi_toLocalizationPresheaf _
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
change Function.Injective (algebraMap (F.presheaf.obj U) _)
haveI : IsLocalization _ (Localization m) := Localization.isLocalization
-- Porting note : `M` and `S` need to be specified manually, so used a hack to save some typing
refine IsLocalization.injective (M := m) (S := Localization m) ?_
|
intro s hs t e
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
change Function.Injective (algebraMap (F.presheaf.obj U) _)
haveI : IsLocalization _ (Localization m) := Localization.isLocalization
-- Porting note : `M` and `S` need to be specified manually, so used a hack to save some typing
refine IsLocalization.injective (M := m) (S := Localization m) ?_
|
Mathlib.Topology.Sheaves.Operations.117_0.VAfusCW1hNuysqq
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf
|
Mathlib_Topology_Sheaves_Operations
|
case this.i
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ x, Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
this : IsLocalization m (Localization m)
s : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
hs : s ∈ m
t : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
e : t * s = 0
⊢ t = 0
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
rw [F.germ_res]
exact hs _
#align Top.presheaf.submonoid_presheaf_of_stalk TopCat.Presheaf.submonoidPresheafOfStalk
noncomputable instance : Inhabited F.SubmonoidPresheaf :=
⟨F.submonoidPresheafOfStalk fun _ => ⊥⟩
/-- The localization of a presheaf of `CommRing`s at locally non-zero-divisor sections. -/
noncomputable def totalQuotientPresheaf : X.Presheaf CommRingCat.{w} :=
(F.submonoidPresheafOfStalk fun x => (F.stalk x)⁰).localizationPresheaf
#align Top.presheaf.total_quotient_presheaf TopCat.Presheaf.totalQuotientPresheaf
/-- The map into the presheaf of total quotient rings -/
noncomputable def toTotalQuotientPresheaf : F ⟶ F.totalQuotientPresheaf :=
SubmonoidPresheaf.toLocalizationPresheaf _
#align Top.presheaf.to_total_quotient_presheaf TopCat.Presheaf.toTotalQuotientPresheaf
-- Porting note : deriving `Epi` failed
instance : Epi (toTotalQuotientPresheaf F) := epi_toLocalizationPresheaf _
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
change Function.Injective (algebraMap (F.presheaf.obj U) _)
haveI : IsLocalization _ (Localization m) := Localization.isLocalization
-- Porting note : `M` and `S` need to be specified manually, so used a hack to save some typing
refine IsLocalization.injective (M := m) (S := Localization m) ?_
intro s hs t e
|
apply section_ext F (unop U)
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
change Function.Injective (algebraMap (F.presheaf.obj U) _)
haveI : IsLocalization _ (Localization m) := Localization.isLocalization
-- Porting note : `M` and `S` need to be specified manually, so used a hack to save some typing
refine IsLocalization.injective (M := m) (S := Localization m) ?_
intro s hs t e
|
Mathlib.Topology.Sheaves.Operations.117_0.VAfusCW1hNuysqq
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf
|
Mathlib_Topology_Sheaves_Operations
|
case this.i.h
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ x, Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
this : IsLocalization m (Localization m)
s : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
hs : s ∈ m
t : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
e : t * s = 0
⊢ ∀ (x : ↥U.unop), (germ (Sheaf.presheaf F) x) t = (germ (Sheaf.presheaf F) x) 0
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
rw [F.germ_res]
exact hs _
#align Top.presheaf.submonoid_presheaf_of_stalk TopCat.Presheaf.submonoidPresheafOfStalk
noncomputable instance : Inhabited F.SubmonoidPresheaf :=
⟨F.submonoidPresheafOfStalk fun _ => ⊥⟩
/-- The localization of a presheaf of `CommRing`s at locally non-zero-divisor sections. -/
noncomputable def totalQuotientPresheaf : X.Presheaf CommRingCat.{w} :=
(F.submonoidPresheafOfStalk fun x => (F.stalk x)⁰).localizationPresheaf
#align Top.presheaf.total_quotient_presheaf TopCat.Presheaf.totalQuotientPresheaf
/-- The map into the presheaf of total quotient rings -/
noncomputable def toTotalQuotientPresheaf : F ⟶ F.totalQuotientPresheaf :=
SubmonoidPresheaf.toLocalizationPresheaf _
#align Top.presheaf.to_total_quotient_presheaf TopCat.Presheaf.toTotalQuotientPresheaf
-- Porting note : deriving `Epi` failed
instance : Epi (toTotalQuotientPresheaf F) := epi_toLocalizationPresheaf _
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
change Function.Injective (algebraMap (F.presheaf.obj U) _)
haveI : IsLocalization _ (Localization m) := Localization.isLocalization
-- Porting note : `M` and `S` need to be specified manually, so used a hack to save some typing
refine IsLocalization.injective (M := m) (S := Localization m) ?_
intro s hs t e
apply section_ext F (unop U)
|
intro x
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
change Function.Injective (algebraMap (F.presheaf.obj U) _)
haveI : IsLocalization _ (Localization m) := Localization.isLocalization
-- Porting note : `M` and `S` need to be specified manually, so used a hack to save some typing
refine IsLocalization.injective (M := m) (S := Localization m) ?_
intro s hs t e
apply section_ext F (unop U)
|
Mathlib.Topology.Sheaves.Operations.117_0.VAfusCW1hNuysqq
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf
|
Mathlib_Topology_Sheaves_Operations
|
case this.i.h
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ x, Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
this : IsLocalization m (Localization m)
s : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
hs : s ∈ m
t : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
e : t * s = 0
x : ↥U.unop
⊢ (germ (Sheaf.presheaf F) x) t = (germ (Sheaf.presheaf F) x) 0
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
rw [F.germ_res]
exact hs _
#align Top.presheaf.submonoid_presheaf_of_stalk TopCat.Presheaf.submonoidPresheafOfStalk
noncomputable instance : Inhabited F.SubmonoidPresheaf :=
⟨F.submonoidPresheafOfStalk fun _ => ⊥⟩
/-- The localization of a presheaf of `CommRing`s at locally non-zero-divisor sections. -/
noncomputable def totalQuotientPresheaf : X.Presheaf CommRingCat.{w} :=
(F.submonoidPresheafOfStalk fun x => (F.stalk x)⁰).localizationPresheaf
#align Top.presheaf.total_quotient_presheaf TopCat.Presheaf.totalQuotientPresheaf
/-- The map into the presheaf of total quotient rings -/
noncomputable def toTotalQuotientPresheaf : F ⟶ F.totalQuotientPresheaf :=
SubmonoidPresheaf.toLocalizationPresheaf _
#align Top.presheaf.to_total_quotient_presheaf TopCat.Presheaf.toTotalQuotientPresheaf
-- Porting note : deriving `Epi` failed
instance : Epi (toTotalQuotientPresheaf F) := epi_toLocalizationPresheaf _
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
change Function.Injective (algebraMap (F.presheaf.obj U) _)
haveI : IsLocalization _ (Localization m) := Localization.isLocalization
-- Porting note : `M` and `S` need to be specified manually, so used a hack to save some typing
refine IsLocalization.injective (M := m) (S := Localization m) ?_
intro s hs t e
apply section_ext F (unop U)
intro x
|
rw [map_zero]
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
change Function.Injective (algebraMap (F.presheaf.obj U) _)
haveI : IsLocalization _ (Localization m) := Localization.isLocalization
-- Porting note : `M` and `S` need to be specified manually, so used a hack to save some typing
refine IsLocalization.injective (M := m) (S := Localization m) ?_
intro s hs t e
apply section_ext F (unop U)
intro x
|
Mathlib.Topology.Sheaves.Operations.117_0.VAfusCW1hNuysqq
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf
|
Mathlib_Topology_Sheaves_Operations
|
case this.i.h
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ x, Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
this : IsLocalization m (Localization m)
s : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
hs : s ∈ m
t : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
e : t * s = 0
x : ↥U.unop
⊢ (germ (Sheaf.presheaf F) x) t = 0
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
rw [F.germ_res]
exact hs _
#align Top.presheaf.submonoid_presheaf_of_stalk TopCat.Presheaf.submonoidPresheafOfStalk
noncomputable instance : Inhabited F.SubmonoidPresheaf :=
⟨F.submonoidPresheafOfStalk fun _ => ⊥⟩
/-- The localization of a presheaf of `CommRing`s at locally non-zero-divisor sections. -/
noncomputable def totalQuotientPresheaf : X.Presheaf CommRingCat.{w} :=
(F.submonoidPresheafOfStalk fun x => (F.stalk x)⁰).localizationPresheaf
#align Top.presheaf.total_quotient_presheaf TopCat.Presheaf.totalQuotientPresheaf
/-- The map into the presheaf of total quotient rings -/
noncomputable def toTotalQuotientPresheaf : F ⟶ F.totalQuotientPresheaf :=
SubmonoidPresheaf.toLocalizationPresheaf _
#align Top.presheaf.to_total_quotient_presheaf TopCat.Presheaf.toTotalQuotientPresheaf
-- Porting note : deriving `Epi` failed
instance : Epi (toTotalQuotientPresheaf F) := epi_toLocalizationPresheaf _
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
change Function.Injective (algebraMap (F.presheaf.obj U) _)
haveI : IsLocalization _ (Localization m) := Localization.isLocalization
-- Porting note : `M` and `S` need to be specified manually, so used a hack to save some typing
refine IsLocalization.injective (M := m) (S := Localization m) ?_
intro s hs t e
apply section_ext F (unop U)
intro x
rw [map_zero]
|
apply Submonoid.mem_iInf.mp hs x
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
change Function.Injective (algebraMap (F.presheaf.obj U) _)
haveI : IsLocalization _ (Localization m) := Localization.isLocalization
-- Porting note : `M` and `S` need to be specified manually, so used a hack to save some typing
refine IsLocalization.injective (M := m) (S := Localization m) ?_
intro s hs t e
apply section_ext F (unop U)
intro x
rw [map_zero]
|
Mathlib.Topology.Sheaves.Operations.117_0.VAfusCW1hNuysqq
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf
|
Mathlib_Topology_Sheaves_Operations
|
case this.i.h.a
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ x, Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
this : IsLocalization m (Localization m)
s : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
hs : s ∈ m
t : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
e : t * s = 0
x : ↥U.unop
⊢ (germ (Sheaf.presheaf F) x) t * (germ (Sheaf.presheaf F) x) s = 0
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
rw [F.germ_res]
exact hs _
#align Top.presheaf.submonoid_presheaf_of_stalk TopCat.Presheaf.submonoidPresheafOfStalk
noncomputable instance : Inhabited F.SubmonoidPresheaf :=
⟨F.submonoidPresheafOfStalk fun _ => ⊥⟩
/-- The localization of a presheaf of `CommRing`s at locally non-zero-divisor sections. -/
noncomputable def totalQuotientPresheaf : X.Presheaf CommRingCat.{w} :=
(F.submonoidPresheafOfStalk fun x => (F.stalk x)⁰).localizationPresheaf
#align Top.presheaf.total_quotient_presheaf TopCat.Presheaf.totalQuotientPresheaf
/-- The map into the presheaf of total quotient rings -/
noncomputable def toTotalQuotientPresheaf : F ⟶ F.totalQuotientPresheaf :=
SubmonoidPresheaf.toLocalizationPresheaf _
#align Top.presheaf.to_total_quotient_presheaf TopCat.Presheaf.toTotalQuotientPresheaf
-- Porting note : deriving `Epi` failed
instance : Epi (toTotalQuotientPresheaf F) := epi_toLocalizationPresheaf _
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
change Function.Injective (algebraMap (F.presheaf.obj U) _)
haveI : IsLocalization _ (Localization m) := Localization.isLocalization
-- Porting note : `M` and `S` need to be specified manually, so used a hack to save some typing
refine IsLocalization.injective (M := m) (S := Localization m) ?_
intro s hs t e
apply section_ext F (unop U)
intro x
rw [map_zero]
apply Submonoid.mem_iInf.mp hs x
-- Porting note : added `dsimp` to make `rw [← map_mul]` work
|
dsimp
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
change Function.Injective (algebraMap (F.presheaf.obj U) _)
haveI : IsLocalization _ (Localization m) := Localization.isLocalization
-- Porting note : `M` and `S` need to be specified manually, so used a hack to save some typing
refine IsLocalization.injective (M := m) (S := Localization m) ?_
intro s hs t e
apply section_ext F (unop U)
intro x
rw [map_zero]
apply Submonoid.mem_iInf.mp hs x
-- Porting note : added `dsimp` to make `rw [← map_mul]` work
|
Mathlib.Topology.Sheaves.Operations.117_0.VAfusCW1hNuysqq
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf
|
Mathlib_Topology_Sheaves_Operations
|
case this.i.h.a
X : TopCat
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : ConcreteCategory C
F✝ : Presheaf CommRingCat X
G : SubmonoidPresheaf F✝
F : Sheaf CommRingCat X
U : (Opens ↑X)ᵒᵖ
m : Submonoid ((forget CommRingCat).obj ((Sheaf.presheaf F).obj U)) :=
⨅ x, Submonoid.comap (germ (Sheaf.presheaf F) x) (↑(stalk (Sheaf.presheaf F) ↑x))⁰
this : IsLocalization m (Localization m)
s : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
hs : s ∈ m
t : (forget CommRingCat).obj ((Sheaf.presheaf F).obj U)
e : t * s = 0
x : ↥U.unop
⊢ (germ (Sheaf.presheaf F) x) t * (germ (Sheaf.presheaf F) x) s = 0
|
/-
Copyright (c) 2022 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
import Mathlib.Algebra.Category.Ring.Instances
import Mathlib.Algebra.Category.Ring.FilteredColimits
import Mathlib.RingTheory.Localization.Basic
import Mathlib.Topology.Sheaves.Stalks
#align_import topology.sheaves.operations from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Operations on sheaves
## Main definition
- `SubmonoidPresheaf` : A subpresheaf with a submonoid structure on each of the components.
- `LocalizationPresheaf` : The localization of a presheaf of commrings at a `SubmonoidPresheaf`.
- `TotalQuotientPresheaf` : The presheaf of total quotient rings.
-/
-- Porting note: all aligns here start with `Top.`
set_option linter.uppercaseLean3 false
open scoped nonZeroDivisors
open TopologicalSpace Opposite CategoryTheory
universe v u w
namespace TopCat
namespace Presheaf
variable {X : TopCat.{w}} {C : Type u} [Category.{v} C] [ConcreteCategory C]
attribute [local instance 1000] ConcreteCategory.hasCoeToSort
/-- A subpresheaf with a submonoid structure on each of the components. -/
structure SubmonoidPresheaf [∀ X : C, MulOneClass X] [∀ X Y : C, MonoidHomClass (X ⟶ Y) X Y]
(F : X.Presheaf C) where
obj : ∀ U, Submonoid (F.obj U)
map : ∀ {U V : (Opens X)ᵒᵖ} (i : U ⟶ V), obj U ≤ (obj V).comap (F.map i)
#align Top.presheaf.submonoid_presheaf TopCat.Presheaf.SubmonoidPresheaf
variable {F : X.Presheaf CommRingCat.{w}} (G : F.SubmonoidPresheaf)
/-- The localization of a presheaf of `CommRing`s with respect to a `SubmonoidPresheaf`. -/
protected noncomputable def SubmonoidPresheaf.localizationPresheaf : X.Presheaf CommRingCat where
obj U := CommRingCat.of <| Localization (G.obj U)
map {U V} i := CommRingCat.ofHom <| IsLocalization.map _ (F.map i) (G.map i)
map_id U := by
simp_rw [F.map_id]
ext x
-- Porting note : `M` and `S` needs to be specified manually
exact IsLocalization.map_id (M := G.obj U) (S := Localization (G.obj U)) x
map_comp {U V W} i j := by
delta CommRingCat.ofHom CommRingCat.of Bundled.of
simp_rw [F.map_comp, CommRingCat.comp_eq_ring_hom_comp]
rw [IsLocalization.map_comp_map]
#align Top.presheaf.submonoid_presheaf.localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.localizationPresheaf
-- Porting note : this instance can't be synthesized
instance (U) : Algebra ((forget CommRingCat).obj (F.obj U)) (G.localizationPresheaf.obj U) :=
show Algebra _ (Localization (G.obj U)) from inferInstance
-- Porting note : this instance can't be synthesized
instance (U) : IsLocalization (G.obj U) (G.localizationPresheaf.obj U) :=
show IsLocalization (G.obj U) (Localization (G.obj U)) from inferInstance
/-- The map into the localization presheaf. -/
@[simps app]
def SubmonoidPresheaf.toLocalizationPresheaf : F ⟶ G.localizationPresheaf where
app U := CommRingCat.ofHom <| algebraMap (F.obj U) (Localization <| G.obj U)
naturality {_ _} i := (IsLocalization.map_comp (G.map i)).symm
#align Top.presheaf.submonoid_presheaf.to_localization_presheaf TopCat.Presheaf.SubmonoidPresheaf.toLocalizationPresheaf
instance epi_toLocalizationPresheaf : Epi G.toLocalizationPresheaf :=
@NatTrans.epi_of_epi_app _ _ _ _ _ _ G.toLocalizationPresheaf fun U => Localization.epi' (G.obj U)
variable (F)
/-- Given a submonoid at each of the stalks, we may define a submonoid presheaf consisting of
sections whose restriction onto each stalk falls in the given submonoid. -/
@[simps]
noncomputable def submonoidPresheafOfStalk (S : ∀ x : X, Submonoid (F.stalk x)) :
F.SubmonoidPresheaf where
obj U := ⨅ x : U.unop, Submonoid.comap (F.germ x) (S x)
map {U V} i := by
intro s hs
simp only [Submonoid.mem_comap, Submonoid.mem_iInf] at hs ⊢
intro x
change (F.map i.unop.op ≫ F.germ x) s ∈ _
rw [F.germ_res]
exact hs _
#align Top.presheaf.submonoid_presheaf_of_stalk TopCat.Presheaf.submonoidPresheafOfStalk
noncomputable instance : Inhabited F.SubmonoidPresheaf :=
⟨F.submonoidPresheafOfStalk fun _ => ⊥⟩
/-- The localization of a presheaf of `CommRing`s at locally non-zero-divisor sections. -/
noncomputable def totalQuotientPresheaf : X.Presheaf CommRingCat.{w} :=
(F.submonoidPresheafOfStalk fun x => (F.stalk x)⁰).localizationPresheaf
#align Top.presheaf.total_quotient_presheaf TopCat.Presheaf.totalQuotientPresheaf
/-- The map into the presheaf of total quotient rings -/
noncomputable def toTotalQuotientPresheaf : F ⟶ F.totalQuotientPresheaf :=
SubmonoidPresheaf.toLocalizationPresheaf _
#align Top.presheaf.to_total_quotient_presheaf TopCat.Presheaf.toTotalQuotientPresheaf
-- Porting note : deriving `Epi` failed
instance : Epi (toTotalQuotientPresheaf F) := epi_toLocalizationPresheaf _
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
change Function.Injective (algebraMap (F.presheaf.obj U) _)
haveI : IsLocalization _ (Localization m) := Localization.isLocalization
-- Porting note : `M` and `S` need to be specified manually, so used a hack to save some typing
refine IsLocalization.injective (M := m) (S := Localization m) ?_
intro s hs t e
apply section_ext F (unop U)
intro x
rw [map_zero]
apply Submonoid.mem_iInf.mp hs x
-- Porting note : added `dsimp` to make `rw [← map_mul]` work
dsimp
|
rw [← map_mul, e, map_zero]
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf := by
-- Porting note : was an `apply (config := { instances := false })`
-- See https://github.com/leanprover/lean4/issues/2273
suffices : ∀ (U : (Opens ↑X)ᵒᵖ), Mono (F.presheaf.toTotalQuotientPresheaf.app U)
· apply NatTrans.mono_of_mono_app
intro U
apply ConcreteCategory.mono_of_injective
dsimp [toTotalQuotientPresheaf, CommRingCat.ofHom]
-- Porting note : this is a hack to make the `refine` below works
set m := _
change Function.Injective (algebraMap _ (Localization m))
change Function.Injective (algebraMap (F.presheaf.obj U) _)
haveI : IsLocalization _ (Localization m) := Localization.isLocalization
-- Porting note : `M` and `S` need to be specified manually, so used a hack to save some typing
refine IsLocalization.injective (M := m) (S := Localization m) ?_
intro s hs t e
apply section_ext F (unop U)
intro x
rw [map_zero]
apply Submonoid.mem_iInf.mp hs x
-- Porting note : added `dsimp` to make `rw [← map_mul]` work
dsimp
|
Mathlib.Topology.Sheaves.Operations.117_0.VAfusCW1hNuysqq
|
instance (F : X.Sheaf CommRingCat.{w}) : Mono F.presheaf.toTotalQuotientPresheaf
|
Mathlib_Topology_Sheaves_Operations
|
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝¹ : MeasurableSpace α
inst✝ : TopologicalSpace β
l l' : Filter α
f✝ g : α → β
μ ν : Measure α
f : α → β
⊢ AEStronglyMeasurable f (Measure.restrict μ ∅)
|
/-
Copyright (c) 2021 Rémy Degenne. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Zhouhang Zhou, Yury Kudryashov
-/
import Mathlib.MeasureTheory.Function.L1Space
import Mathlib.Analysis.NormedSpace.IndicatorFunction
#align_import measure_theory.integral.integrable_on from "leanprover-community/mathlib"@"8b8ba04e2f326f3f7cf24ad129beda58531ada61"
/-! # Functions integrable on a set and at a filter
We define `IntegrableOn f s μ := Integrable f (μ.restrict s)` and prove theorems like
`integrableOn_union : IntegrableOn f (s ∪ t) μ ↔ IntegrableOn f s μ ∧ IntegrableOn f t μ`.
Next we define a predicate `IntegrableAtFilter (f : α → E) (l : Filter α) (μ : Measure α)`
saying that `f` is integrable at some set `s ∈ l` and prove that a measurable function is integrable
at `l` with respect to `μ` provided that `f` is bounded above at `l ⊓ μ.ae` and `μ` is finite
at `l`.
-/
noncomputable section
open Set Filter TopologicalSpace MeasureTheory Function
open scoped Classical Topology Interval BigOperators Filter ENNReal MeasureTheory
variable {α β E F : Type*} [MeasurableSpace α]
section
variable [TopologicalSpace β] {l l' : Filter α} {f g : α → β} {μ ν : Measure α}
/-- A function `f` is strongly measurable at a filter `l` w.r.t. a measure `μ` if it is
ae strongly measurable w.r.t. `μ.restrict s` for some `s ∈ l`. -/
def StronglyMeasurableAtFilter (f : α → β) (l : Filter α) (μ : Measure α := by volume_tac) :=
∃ s ∈ l, AEStronglyMeasurable f (μ.restrict s)
#align strongly_measurable_at_filter StronglyMeasurableAtFilter
@[simp]
theorem stronglyMeasurableAt_bot {f : α → β} : StronglyMeasurableAtFilter f ⊥ μ :=
⟨∅, mem_bot, by
|
simp
|
@[simp]
theorem stronglyMeasurableAt_bot {f : α → β} : StronglyMeasurableAtFilter f ⊥ μ :=
⟨∅, mem_bot, by
|
Mathlib.MeasureTheory.Integral.IntegrableOn.42_0.qIpN2P2TD1gUH4J
|
@[simp]
theorem stronglyMeasurableAt_bot {f : α → β} : StronglyMeasurableAtFilter f ⊥ μ
|
Mathlib_MeasureTheory_Integral_IntegrableOn
|
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝¹ : MeasurableSpace α
inst✝ : TopologicalSpace β
l l' : Filter α
f g : α → β
μ ν : Measure α
h : AEStronglyMeasurable f μ
⊢ AEStronglyMeasurable f (Measure.restrict μ univ)
|
/-
Copyright (c) 2021 Rémy Degenne. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Zhouhang Zhou, Yury Kudryashov
-/
import Mathlib.MeasureTheory.Function.L1Space
import Mathlib.Analysis.NormedSpace.IndicatorFunction
#align_import measure_theory.integral.integrable_on from "leanprover-community/mathlib"@"8b8ba04e2f326f3f7cf24ad129beda58531ada61"
/-! # Functions integrable on a set and at a filter
We define `IntegrableOn f s μ := Integrable f (μ.restrict s)` and prove theorems like
`integrableOn_union : IntegrableOn f (s ∪ t) μ ↔ IntegrableOn f s μ ∧ IntegrableOn f t μ`.
Next we define a predicate `IntegrableAtFilter (f : α → E) (l : Filter α) (μ : Measure α)`
saying that `f` is integrable at some set `s ∈ l` and prove that a measurable function is integrable
at `l` with respect to `μ` provided that `f` is bounded above at `l ⊓ μ.ae` and `μ` is finite
at `l`.
-/
noncomputable section
open Set Filter TopologicalSpace MeasureTheory Function
open scoped Classical Topology Interval BigOperators Filter ENNReal MeasureTheory
variable {α β E F : Type*} [MeasurableSpace α]
section
variable [TopologicalSpace β] {l l' : Filter α} {f g : α → β} {μ ν : Measure α}
/-- A function `f` is strongly measurable at a filter `l` w.r.t. a measure `μ` if it is
ae strongly measurable w.r.t. `μ.restrict s` for some `s ∈ l`. -/
def StronglyMeasurableAtFilter (f : α → β) (l : Filter α) (μ : Measure α := by volume_tac) :=
∃ s ∈ l, AEStronglyMeasurable f (μ.restrict s)
#align strongly_measurable_at_filter StronglyMeasurableAtFilter
@[simp]
theorem stronglyMeasurableAt_bot {f : α → β} : StronglyMeasurableAtFilter f ⊥ μ :=
⟨∅, mem_bot, by simp⟩
#align strongly_measurable_at_bot stronglyMeasurableAt_bot
protected theorem StronglyMeasurableAtFilter.eventually (h : StronglyMeasurableAtFilter f l μ) :
∀ᶠ s in l.smallSets, AEStronglyMeasurable f (μ.restrict s) :=
(eventually_smallSets' fun _ _ => AEStronglyMeasurable.mono_set).2 h
#align strongly_measurable_at_filter.eventually StronglyMeasurableAtFilter.eventually
protected theorem StronglyMeasurableAtFilter.filter_mono (h : StronglyMeasurableAtFilter f l μ)
(h' : l' ≤ l) : StronglyMeasurableAtFilter f l' μ :=
let ⟨s, hsl, hs⟩ := h
⟨s, h' hsl, hs⟩
#align strongly_measurable_at_filter.filter_mono StronglyMeasurableAtFilter.filter_mono
protected theorem MeasureTheory.AEStronglyMeasurable.stronglyMeasurableAtFilter
(h : AEStronglyMeasurable f μ) : StronglyMeasurableAtFilter f l μ :=
⟨univ, univ_mem, by
|
rwa [Measure.restrict_univ]
|
protected theorem MeasureTheory.AEStronglyMeasurable.stronglyMeasurableAtFilter
(h : AEStronglyMeasurable f μ) : StronglyMeasurableAtFilter f l μ :=
⟨univ, univ_mem, by
|
Mathlib.MeasureTheory.Integral.IntegrableOn.58_0.qIpN2P2TD1gUH4J
|
protected theorem MeasureTheory.AEStronglyMeasurable.stronglyMeasurableAtFilter
(h : AEStronglyMeasurable f μ) : StronglyMeasurableAtFilter f l μ
|
Mathlib_MeasureTheory_Integral_IntegrableOn
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.