Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit dba3018

Browse files
committed
feat(category_theory): the category of indexed families of objects (#3735)
Pulling out a definition from #3638, and add some associated basic material. Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
1 parent 3c2ed2a commit dba3018

File tree

4 files changed

+151
-47
lines changed

4 files changed

+151
-47
lines changed

src/category_theory/graded_object.lean

Lines changed: 9 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ Authors: Scott Morrison
55
-/
66
import category_theory.shift
77
import category_theory.concrete_category
8+
import category_theory.pi.basic
89

910
/-!
1011
# The category of graded objects
1112
1213
For any type `β`, a `β`-graded object over some category `C` is just
1314
a function `β → C` into the objects of `C`.
14-
We define the category structure on these.
15+
We put the "pointwise" category structure on these, as the non-dependent specialization of
16+
`category_theory.pi`.
1517
1618
We describe the `comap` functors obtained by precomposing with functions `β → γ`.
1719
@@ -22,6 +24,7 @@ When `C` has coproducts we construct the `total` functor `graded_object β C ⥤
2224
show that it is faithful, and deduce that when `C` is concrete so is `graded_object β C`.
2325
-/
2426

27+
open category_theory.pi
2528
open category_theory.limits
2629

2730
namespace category_theory
@@ -48,61 +51,25 @@ namespace graded_object
4851
variables {C : Type u} [category.{v} C]
4952

5053
instance category_of_graded_objects (β : Type w) : category.{(max w v)} (graded_object β C) :=
51-
{ hom := λ X Y, Π b : β, X b ⟶ Y b,
52-
id := λ X b, 𝟙 (X b),
53-
comp := λ X Y Z f g b, f b ≫ g b, }
54+
category_theory.pi (λ _, C)
5455

55-
@[simp]
56-
lemma id_apply {β : Type w} (X : graded_object β C) (b : β) :
57-
((𝟙 X) : Π b, X b ⟶ X b) b = 𝟙 (X b) := rfl
5856

59-
@[simp]
60-
lemma comp_apply {β : Type w} {X Y Z : graded_object β C} (f : X ⟶ Y) (g : Y ⟶ Z) (b : β) :
61-
((f ≫ g) : Π b, X b ⟶ Z b) b = f b ≫ g b := rfl
6257

6358
section
6459
variable (C)
6560

66-
/-- Pull back a graded object along a change-of-grading function. -/
67-
@[simps]
68-
def comap {β γ : Type w} (f : β → γ) :
69-
(graded_object γ C) ⥤ (graded_object β C) :=
70-
{ obj := λ X, X ∘ f,
71-
map := λ X Y g b, g (f b) }
72-
73-
/--
74-
The natural isomorphism between
75-
pulling back a grading along the identity function,
76-
and the identity functor. -/
77-
@[simps]
78-
def comap_id (β : Type w) : comap C (id : β → β) ≅ 𝟭 (graded_object β C) :=
79-
{ hom := { app := λ X, 𝟙 X },
80-
inv := { app := λ X, 𝟙 X } }.
81-
82-
/--
83-
The natural isomorphism comparing between
84-
pulling back along two successive functions, and
85-
pulling back along their composition
86-
-/
87-
@[simps]
88-
def comap_comp {β γ δ : Type w} (f : β → γ) (g : γ → δ) : comap C g ⋙ comap C f ≅ comap C (g ∘ f) :=
89-
{ hom := { app := λ X b, 𝟙 (X (g (f b))) },
90-
inv := { app := λ X b, 𝟙 (X (g (f b))) } }
91-
9261
/--
9362
The natural isomorphism comparing between
9463
pulling back along two propositionally equal functions.
9564
-/
9665
@[simps]
97-
def comap_eq {β γ : Type w} {f g : β → γ} (h : f = g) : comap C f ≅ comap C g :=
66+
def comap_eq {β γ : Type w} {f g : β → γ} (h : f = g) : comap (λ _, C) f ≅ comap (λ _, C) g :=
9867
{ hom := { app := λ X b, eq_to_hom begin dsimp [comap], subst h, end },
9968
inv := { app := λ X b, eq_to_hom begin dsimp [comap], subst h, end }, }
10069

101-
@[simp]
10270
lemma comap_eq_symm {β γ : Type w} {f g : β → γ} (h : f = g) : comap_eq C h.symm = (comap_eq C h).symm :=
10371
by tidy
10472

105-
@[simp]
10673
lemma comap_eq_trans {β γ : Type w} {f g h : β → γ} (k : f = g) (l : g = h) :
10774
comap_eq C (k.trans l) = comap_eq C k ≪≫ comap_eq C l :=
10875
begin
@@ -117,9 +84,9 @@ given an equivalence between β and γ.
11784
@[simps]
11885
def comap_equiv {β γ : Type w} (e : β ≃ γ) :
11986
(graded_object β C) ≌ (graded_object γ C) :=
120-
{ functor := comap C (e.symm : γ → β),
121-
inverse := comap C (e : β → γ),
122-
counit_iso := (comap_comp C _ _).trans (comap_eq C (by { ext, simp } )),
87+
{ functor := comap (λ _, C) (e.symm : γ → β),
88+
inverse := comap (λ _, C) (e : β → γ),
89+
counit_iso := (comap_comp (λ _, C) _ _).trans (comap_eq C (by { ext, simp } )),
12390
unit_iso := (comap_eq C (by { ext, simp } )).trans (comap_comp _ _ _).symm,
12491
functor_unit_iso_comp' := λ X, by { ext b, dsimp, simp, }, } -- See note [dsimp, simp].
12592

src/category_theory/pi/basic.lean

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
/-
2+
Copyright (c) 2020 Scott Morrison. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Simon Hudon, Scott Morrison
5+
-/
6+
import category_theory.natural_isomorphism
7+
import category_theory.eq_to_hom
8+
9+
/-!
10+
# Categories of indexed families of objects.
11+
12+
We define the pointwise category structure on indexed families of objects in a category
13+
(and also the dependent generalization).
14+
15+
-/
16+
17+
namespace category_theory
18+
19+
universes w₀ w₁ w₂ v₁ v₂ u₁ u₂
20+
21+
variables {I : Type w₀} (C : I → Type u₁) [∀ i, category.{v₁} (C i)]
22+
23+
/--
24+
`pi C` gives the cartesian product of an indexed family of categories.
25+
-/
26+
instance pi : category.{max w₀ v₁} (Π i, C i) :=
27+
{ hom := λ X Y, Π i, X i ⟶ Y i,
28+
id := λ X i, 𝟙 (X i),
29+
comp := λ X Y Z f g i, f i ≫ g i }
30+
31+
namespace pi
32+
33+
@[simp] lemma id_apply (X : Π i, C i) (i) : (𝟙 X : Π i, X i ⟶ X i) i = 𝟙 (X i) := rfl
34+
@[simp] lemma comp_apply {X Y Z : Π i, C i} (f : X ⟶ Y) (g : Y ⟶ Z) (i) :
35+
(f ≫ g : Π i, X i ⟶ Z i) i = f i ≫ g i := rfl
36+
37+
/--
38+
The evaluation functor at `i : I`, sending an `I`-indexed family of objects to the object over `i`.
39+
-/
40+
@[simps]
41+
def eval (i : I) : (Π i, C i) ⥤ C i :=
42+
{ obj := λ f, f i,
43+
map := λ f g α, α i, }
44+
45+
section
46+
variables {J : Type w₁}
47+
48+
/--
49+
Pull back an `I`-indexed family of objects to an `J`-indexed family, along a function `J → I`.
50+
-/
51+
@[simps]
52+
def comap (h : J → I) : (Π i, C i) ⥤ (Π j, C (h j)) :=
53+
{ obj := λ f i, f (h i),
54+
map := λ f g α i, α (h i), }
55+
56+
variables (I)
57+
/--
58+
The natural isomorphism between
59+
pulling back a grading along the identity function,
60+
and the identity functor. -/
61+
@[simps]
62+
def comap_id : comap C (id : I → I) ≅ 𝟭 (Π i, C i) :=
63+
{ hom := { app := λ X, 𝟙 X },
64+
inv := { app := λ X, 𝟙 X } }.
65+
66+
variables {I}
67+
variables {K : Type w₂}
68+
69+
/--
70+
The natural isomorphism comparing between
71+
pulling back along two successive functions, and
72+
pulling back along their composition
73+
-/
74+
@[simps]
75+
def comap_comp (f : K → J) (g : J → I) : comap C g ⋙ comap (C ∘ g) f ≅ comap C (g ∘ f) :=
76+
{ hom := { app := λ X b, 𝟙 (X (g (f b))) },
77+
inv := { app := λ X b, 𝟙 (X (g (f b))) } }
78+
79+
/-- The natural isomorphism between pulling back then evaluating, and just evaluating. -/
80+
@[simps {rhs_md := semireducible}]
81+
def comap_eval_iso_eval (h : J → I) (j : J) : comap C h ⋙ eval (C ∘ h) j ≅ eval C (h j) :=
82+
nat_iso.of_components (λ f, iso.refl _) (by tidy)
83+
84+
end
85+
86+
section
87+
variables {J : Type w₀} {D : J → Type u₁} [∀ j, category.{v₁} (D j)]
88+
89+
instance sum_elim_category : Π (s : I ⊕ J), category.{v₁} (sum.elim C D s)
90+
| (sum.inl i) := by { dsimp, apply_instance, }
91+
| (sum.inr j) := by { dsimp, apply_instance, }
92+
93+
/--
94+
The bifunctor combining an `I`-indexed family of objects with a `J`-indexed family of objects
95+
to obtain an `I ⊕ J`-indexed family of objects.
96+
-/
97+
@[simps]
98+
def sum : (Π i, C i) ⥤ (Π j, D j) ⥤ (Π s : I ⊕ J, sum.elim C D s) :=
99+
{ obj := λ f,
100+
{ obj := λ g s, sum.rec f g s,
101+
map := λ g g' α s, sum.rec (λ i, 𝟙 (f i)) α s },
102+
map := λ f f' α,
103+
{ app := λ g s, sum.rec α (λ j, 𝟙 (g j)) s, }}
104+
105+
end
106+
107+
end pi
108+
109+
namespace functor
110+
111+
variables {C}
112+
variables {D : I → Type u₁} [∀ i, category.{v₁} (D i)]
113+
114+
/--
115+
Assemble an `I`-indexed family of functors into a functor between the pi types.
116+
-/
117+
@[simps]
118+
def pi (F : Π i, C i ⥤ D i) : (Π i, C i) ⥤ (Π i, D i) :=
119+
{ obj := λ f i, (F i).obj (f i),
120+
map := λ f g α i, (F i).map (α i) }
121+
122+
-- One could add some natural isomorphisms showing
123+
-- how `functor.pi` commutes with `pi.eval` and `pi.comap`.
124+
125+
end functor
126+
127+
namespace nat_trans
128+
129+
variables {C}
130+
variables {D : I → Type u₁} [∀ i, category.{v₁} (D i)]
131+
variables {F G : Π i, C i ⥤ D i}
132+
133+
/--
134+
Assemble an `I`-indexed family of natural transformations into a single natural transformation.
135+
-/
136+
@[simps]
137+
def pi (α : Π i, F i ⟶ G i) : functor.pi F ⟶ functor.pi G :=
138+
{ app := λ f i, (α i).app (f i), }
139+
140+
end nat_trans
141+
142+
end category_theory

src/category_theory/products/associator.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ variables (C : Type u₁) [category.{v₁} C]
2222
/--
2323
The associator functor `(C × D) × E ⥤ C × (D × E)`.
2424
-/
25-
-- Here and below we specify explicitly the projections to generate `@[simp]` lemmas for,
26-
-- as the default behaviour of `@[simps]` will generate projections all the way down to components of pairs.
2725
@[simps] def associator : (C × D) × E ⥤ C × (D × E) :=
2826
{ obj := λ X, (X.1.1, (X.1.2, X.2)),
2927
map := λ _ _ f, (f.1.1, (f.1.2, f.2)) }

src/category_theory/products/basic.lean

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ end
4646
namespace prod
4747

4848
/-- `sectl C Z` is the functor `C ⥤ C × D` given by `X ↦ (X, Z)`. -/
49-
-- Here and below we specify explicitly the projections to generate `@[simp]` lemmas for,
50-
-- as the default behaviour of `@[simps]` will generate projections all the way down to components
51-
-- of pairs.
5249
@[simps] def sectl
5350
(C : Type u₁) [category.{v₁} C] {D : Type u₂} [category.{v₂} D] (Z : D) : C ⥤ C × D :=
5451
{ obj := λ X, (X, Z),

0 commit comments

Comments
 (0)