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

Commit 6aa0e30

Browse files
committed
feat(category_theory/preadditive): additive functors preserve biproducts (#6882)
An additive functor between preadditive categories creates and preserves biproducts. Also, renames `src/category_theory/abelian/additive_functor.lean` to `src/category_theory/preadditive/additive_functor.lean` as it so far doesn't actually rely on anything being abelian. Also, moves the `.map_X` lemmas about additive functors into the `functor` namespace, so we can use dot notation `F.map_add` etc, when `[functor.additive F]` is available. Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
1 parent 4ddbdc1 commit 6aa0e30

File tree

6 files changed

+143
-73
lines changed

6 files changed

+143
-73
lines changed

src/algebra/homology/chain_complex.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Authors: Scott Morrison
66
import data.int.basic
77
import category_theory.graded_object
88
import category_theory.differential_object
9-
import category_theory.abelian.additive_functor
9+
import category_theory.preadditive.additive_functor
1010

1111
/-!
1212
# Chain complexes

src/category_theory/abelian/additive_functor.lean

Lines changed: 0 additions & 70 deletions
This file was deleted.

src/category_theory/functor.lean

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ infixr ` ⋙ `:80 := comp
9090
protected lemma comp_id (F : C ⥤ D) : F ⋙ (𝟭 D) = F := by cases F; refl
9191
protected lemma id_comp (F : C ⥤ D) : (𝟭 C) ⋙ F = F := by cases F; refl
9292

93+
@[simp] lemma map_dite (F : C ⥤ D) {X Y : C} {P : Prop} [decidable P]
94+
(f : P → (X ⟶ Y)) (g : ¬P → (X ⟶ Y)) :
95+
F.map (if h : P then f h else g h) = if h : P then F.map (f h) else F.map (g h) :=
96+
by { split_ifs; refl, }
97+
9398
end
9499

95100
@[mono] lemma monotone {α β : Type*} [preorder α] [preorder β] (F : α ⥤ β) :
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
/-
2+
Copyright (c) 2021 Adam Topaz. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Adam Topaz, Scott Morrison
5+
-/
6+
import category_theory.preadditive
7+
import category_theory.limits.shapes.biproducts
8+
9+
/-!
10+
# Additive Functors
11+
12+
A functor between two preadditive categories is called *additive*
13+
provided that the induced map on hom types is a morphism of abelian
14+
groups.
15+
16+
An additive functor between preadditive categories creates and preserves biproducts.
17+
18+
# Implementation details
19+
20+
`functor.additive` is a `Prop`-valued class, defined by saying that
21+
for every two objects `X` and `Y`, the map
22+
`F.map : (X ⟶ Y) → (F.obj X ⟶ F.obj Y)` is a morphism of abelian
23+
groups.
24+
25+
# Project:
26+
27+
- Prove that a functor is additive if it preserves finite biproducts
28+
(See https://stacks.math.columbia.edu/tag/010M.)
29+
-/
30+
31+
namespace category_theory
32+
33+
/-- A functor `F` is additive provided `F.map` is an additive homomorphism. -/
34+
class functor.additive {C D : Type*} [category C] [category D]
35+
[preadditive C] [preadditive D] (F : C ⥤ D) : Prop :=
36+
(map_zero' : Π {X Y : C}, F.map (0 : X ⟶ Y) = 0 . obviously)
37+
(map_add' : Π {X Y : C} {f g : X ⟶ Y}, F.map (f + g) = F.map f + F.map g . obviously)
38+
39+
section preadditive
40+
41+
namespace functor
42+
43+
section
44+
variables {C D : Type*} [category C] [category D] [preadditive C]
45+
[preadditive D] (F : C ⥤ D) [functor.additive F]
46+
47+
@[simp]
48+
lemma map_zero {X Y : C} : F.map (0 : X ⟶ Y) = 0 :=
49+
functor.additive.map_zero'
50+
51+
@[simp]
52+
lemma map_add {X Y : C} {f g : X ⟶ Y} : F.map (f + g) = F.map f + F.map g :=
53+
functor.additive.map_add'
54+
55+
instance : additive (𝟭 C) :=
56+
{}
57+
58+
instance {E : Type*} [category E] [preadditive E] (G : D ⥤ E) [functor.additive G] :
59+
additive (F ⋙ G) :=
60+
{}
61+
62+
/-- `F.map_add_hom` is an additive homomorphism whose underlying function is `F.map`. -/
63+
@[simps]
64+
def map_add_hom {X Y : C} : (X ⟶ Y) →+ (F.obj X ⟶ F.obj Y) :=
65+
{ to_fun := λ f, F.map f,
66+
map_zero' := F.map_zero,
67+
map_add' := λ _ _, F.map_add }
68+
69+
lemma coe_map_add_hom {X Y : C} : ⇑(F.map_add_hom : (X ⟶ Y) →+ _) = @map C _ D _ F X Y := rfl
70+
71+
@[simp]
72+
lemma map_neg {X Y : C} {f : X ⟶ Y} : F.map (-f) = - F.map f :=
73+
F.map_add_hom.map_neg _
74+
75+
@[simp]
76+
lemma map_sub {X Y : C} {f g : X ⟶ Y} : F.map (f - g) = F.map f - F.map g :=
77+
F.map_add_hom.map_sub _ _
78+
79+
open_locale big_operators
80+
81+
@[simp]
82+
lemma map_sum {X Y : C} {α : Type*} (f : α → (X ⟶ Y)) (s : finset α) :
83+
F.map (∑ a in s, f a) = ∑ a in s, F.map (f a) :=
84+
(F.map_add_hom : (X ⟶ Y) →+ _).map_sum f s
85+
86+
end
87+
88+
section
89+
-- To talk about preservation of biproducts we need to specify universes explicitly.
90+
91+
noncomputable theory
92+
universes v u₁ u₂
93+
94+
variables {C : Type u₁} {D : Type u₂} [category.{v} C] [category.{v} D]
95+
[preadditive C] [preadditive D] (F : C ⥤ D) [functor.additive F]
96+
97+
open category_theory.limits
98+
99+
/--
100+
An additive functor between preadditive categories creates finite biproducts.
101+
-/
102+
instance map_has_biproduct {J : Type v} [fintype J] [decidable_eq J] (f : J → C) [has_biproduct f] :
103+
has_biproduct (λ j, F.obj (f j)) :=
104+
has_biproduct_of_total
105+
{ X := F.obj (⨁ f),
106+
π := λ j, F.map (biproduct.π f j),
107+
ι := λ j, F.map (biproduct.ι f j),
108+
ι_π := λ j j', by { simp only [←F.map_comp], split_ifs, { subst h, simp, }, { simp [h], }, }, }
109+
(by simp_rw [←F.map_comp, ←F.map_sum, biproduct.total, functor.map_id])
110+
111+
/--
112+
An additive functor between preadditive categories preserves finite biproducts.
113+
-/
114+
-- This essentially repeats the work of the previous instance,
115+
-- but gives good definitional reduction to `biproduct.lift` and `biproduct.desc`.
116+
@[simps]
117+
def map_biproduct {J : Type v} [fintype J] [decidable_eq J] (f : J → C) [has_biproduct f] :
118+
F.obj (⨁ f) ≅ ⨁ (λ j, F.obj (f j)) :=
119+
{ hom := biproduct.lift (λ j, F.map (biproduct.π f j)),
120+
inv := biproduct.desc (λ j, F.map (biproduct.ι f j)),
121+
hom_inv_id' :=
122+
by simp only [biproduct.lift_desc, ←F.map_comp, ←F.map_sum, biproduct.total, F.map_id],
123+
inv_hom_id' :=
124+
begin
125+
ext j j',
126+
simp only [category.comp_id, category.assoc, biproduct.lift_π, biproduct.ι_desc_assoc,
127+
←F.map_comp, biproduct.ι_π, F.map_dite, dif_ctx_congr, eq_to_hom_map, F.map_zero],
128+
end }
129+
130+
end
131+
132+
end functor
133+
end preadditive
134+
135+
end category_theory

src/category_theory/triangulated/basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Authors: Luke Kershaw
55
-/
66
import category_theory.additive.basic
77
import category_theory.shift
8-
import category_theory.abelian.additive_functor
8+
import category_theory.preadditive.additive_functor
99

1010
/-!
1111
# Triangles

src/category_theory/triangulated/rotate.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Authors: Luke Kershaw
55
-/
66
import category_theory.additive.basic
77
import category_theory.shift
8-
import category_theory.abelian.additive_functor
8+
import category_theory.preadditive.additive_functor
99
import category_theory.natural_isomorphism
1010
import category_theory.triangulated.basic
1111

0 commit comments

Comments
 (0)