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

Commit f7baecb

Browse files
committed
feat(category_theory/functor): preserving/reflecting monos/epis (#14829)
1 parent 3536347 commit f7baecb

File tree

14 files changed

+228
-81
lines changed

14 files changed

+228
-81
lines changed

src/algebra/category/Group/abelian.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ variables {X Y : AddCommGroup.{u}} (f : X ⟶ Y)
2828
/-- In the category of abelian groups, every monomorphism is normal. -/
2929
def normal_mono (hf : mono f) : normal_mono f :=
3030
equivalence_reflects_normal_mono (forget₂ (Module.{u} ℤ) AddCommGroup.{u}).inv $
31-
Module.normal_mono _ $ right_adjoint_preserves_mono (functor.adjunction _) hf
31+
Module.normal_mono _ infer_instance
3232

3333
/-- In the category of abelian groups, every epimorphism is normal. -/
3434
def normal_epi (hf : epi f) : normal_epi f :=
3535
equivalence_reflects_normal_epi (forget₂ (Module.{u} ℤ) AddCommGroup.{u}).inv $
36-
Module.normal_epi _ $ left_adjoint_preserves_epi (functor.adjunction _) hf
36+
Module.normal_epi _ infer_instance
3737

3838
end
3939

src/algebra/category/Group/adjunctions.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,16 @@ adjunction.mk_of_hom_equiv
6565
hom_equiv_naturality_left_symm' :=
6666
by { intros, ext, refl} }
6767

68+
instance : is_right_adjoint (forget AddCommGroup.{u}) := ⟨_, adj⟩
69+
6870
/--
6971
As an example, we now give a high-powered proof that
7072
the monomorphisms in `AddCommGroup` are just the injective functions.
7173
7274
(This proof works in all universes.)
7375
-/
7476
example {G H : AddCommGroup.{u}} (f : G ⟶ H) [mono f] : function.injective f :=
75-
(mono_iff_injective f).1 (right_adjoint_preserves_mono adj (by apply_instance : mono f))
76-
77-
instance : is_right_adjoint (forget AddCommGroup.{u}) := ⟨_, adj⟩
77+
(mono_iff_injective f).1 (show mono ((forget AddCommGroup.{u}).map f), by apply_instance)
7878

7979
end AddCommGroup
8080

src/algebraic_geometry/open_immersion.lean

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,8 @@ include H
630630
local notation `forget` := SheafedSpace.forget_to_PresheafedSpace
631631
open category_theory.limits.walking_cospan
632632

633-
instance : mono f := faithful_reflects_mono forget
634-
(show @mono (PresheafedSpace C) _ _ _ f, by apply_instance)
633+
instance : mono f :=
634+
forget .mono_of_mono_map (show @mono (PresheafedSpace C) _ _ _ f, by apply_instance)
635635

636636
instance forget_map_is_open_immersion :
637637
PresheafedSpace.is_open_immersion (forget .map f) := ⟨H.base_open, H.c_iso⟩
@@ -862,8 +862,7 @@ instance comp (g : Z ⟶ Y) [LocallyRingedSpace.is_open_immersion g] :
862862
LocallyRingedSpace.is_open_immersion (f ≫ g) := PresheafedSpace.is_open_immersion.comp f.1 g.1
863863

864864
instance mono : mono f :=
865-
faithful_reflects_mono (LocallyRingedSpace.forget_to_SheafedSpace)
866-
(show mono f.1, by apply_instance)
865+
LocallyRingedSpace.forget_to_SheafedSpace.mono_of_mono_map (show mono f.1, by apply_instance)
867866

868867
instance : SheafedSpace.is_open_immersion (LocallyRingedSpace.forget_to_SheafedSpace.map f) := H
869868

@@ -1405,8 +1404,7 @@ include H
14051404
local notation `forget` := Scheme.forget_to_LocallyRingedSpace
14061405

14071406
instance mono : mono f :=
1408-
faithful_reflects_mono (induced_functor _)
1409-
(show @mono LocallyRingedSpace _ _ _ f, by apply_instance)
1407+
(induced_functor _).mono_of_mono_map (show @mono LocallyRingedSpace _ _ _ f, by apply_instance)
14101408

14111409
instance forget_map_is_open_immersion : LocallyRingedSpace.is_open_immersion (forget .map f) :=
14121410
⟨H.base_open, H.c_iso⟩

src/category_theory/adjunction/evaluation.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Authors: Adam Topaz
55
-/
66

77
import category_theory.limits.shapes.products
8-
import category_theory.epi_mono
8+
import category_theory.functor.epi_mono
99

1010
/-!
1111
@@ -79,8 +79,8 @@ lemma nat_trans.mono_iff_app_mono {F G : C ⥤ D} (η : F ⟶ G) :
7979
mono η ↔ (∀ c, mono (η.app c)) :=
8080
begin
8181
split,
82-
{ intros h c,
83-
exact right_adjoint_preserves_mono (evaluation_adjunction_right D c) h },
82+
{ introsI h c,
83+
exact (infer_instance : mono (((evaluation _ _).obj c).map η)) },
8484
{ introsI _,
8585
apply nat_trans.mono_app_of_mono }
8686
end
@@ -144,8 +144,8 @@ lemma nat_trans.epi_iff_app_epi {F G : C ⥤ D} (η : F ⟶ G) :
144144
epi η ↔ (∀ c, epi (η.app c)) :=
145145
begin
146146
split,
147-
{ intros h c,
148-
exact left_adjoint_preserves_epi (evaluation_adjunction_left D c) h },
147+
{ introsI h c,
148+
exact (infer_instance : epi (((evaluation _ _).obj c).map η)) },
149149
{ introsI,
150150
apply nat_trans.epi_app_of_epi }
151151
end

src/category_theory/concrete_category/basic.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Scott Morrison, Johannes Hölzl, Reid Barton, Sean Leather, Yury Kudryashov
55
-/
66
import category_theory.types
7-
import category_theory.epi_mono
7+
import category_theory.functor.epi_mono
88

99
/-!
1010
# Concrete categories
@@ -127,12 +127,12 @@ congr_arg (f : X → Y) h
127127
/-- In any concrete category, injective morphisms are monomorphisms. -/
128128
lemma concrete_category.mono_of_injective {X Y : C} (f : X ⟶ Y) (i : function.injective f) :
129129
mono f :=
130-
faithful_reflects_mono (forget C) ((mono_iff_injective f).2 i)
130+
(forget C).mono_of_mono_map ((mono_iff_injective f).2 i)
131131

132132
/-- In any concrete category, surjective morphisms are epimorphisms. -/
133133
lemma concrete_category.epi_of_surjective {X Y : C} (f : X ⟶ Y) (s : function.surjective f) :
134134
epi f :=
135-
faithful_reflects_epi (forget C) ((epi_iff_surjective f).2 s)
135+
(forget C).epi_of_epi_map ((epi_iff_surjective f).2 s)
136136

137137
@[simp] lemma concrete_category.has_coe_to_fun_Type {X Y : Type u} (f : X ⟶ Y) :
138138
coe_fn f = f :=

src/category_theory/epi_mono.lean

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -32,48 +32,6 @@ instance op_mono_of_epi {A B : C} (f : A ⟶ B) [epi f] : mono f.op :=
3232
instance op_epi_of_mono {A B : C} (f : A ⟶ B) [mono f] : epi f.op :=
3333
⟨λ Z g h eq, quiver.hom.unop_inj ((cancel_mono f).1 (quiver.hom.op_inj eq))⟩
3434

35-
section
36-
variables {D : Type u₂} [category.{v₂} D]
37-
38-
lemma left_adjoint_preserves_epi {F : C ⥤ D} {G : D ⥤ C} (adj : F ⊣ G)
39-
{X Y : C} {f : X ⟶ Y} (hf : epi f) : epi (F.map f) :=
40-
begin
41-
constructor,
42-
intros Z g h H,
43-
replace H := congr_arg (adj.hom_equiv X Z) H,
44-
rwa [adj.hom_equiv_naturality_left, adj.hom_equiv_naturality_left,
45-
cancel_epi, equiv.apply_eq_iff_eq] at H
46-
end
47-
48-
lemma right_adjoint_preserves_mono {F : C ⥤ D} {G : D ⥤ C} (adj : F ⊣ G)
49-
{X Y : D} {f : X ⟶ Y} (hf : mono f) : mono (G.map f) :=
50-
begin
51-
constructor,
52-
intros Z g h H,
53-
replace H := congr_arg (adj.hom_equiv Z Y).symm H,
54-
rwa [adj.hom_equiv_naturality_right_symm, adj.hom_equiv_naturality_right_symm,
55-
cancel_mono, equiv.apply_eq_iff_eq] at H
56-
end
57-
58-
instance is_equivalence.epi_map {F : C ⥤ D} [is_left_adjoint F] {X Y : C} {f : X ⟶ Y}
59-
[h : epi f] : epi (F.map f) :=
60-
left_adjoint_preserves_epi (adjunction.of_left_adjoint F) h
61-
62-
instance is_equivalence.mono_map {F : C ⥤ D} [is_right_adjoint F] {X Y : C} {f : X ⟶ Y}
63-
[h : mono f] : mono (F.map f) :=
64-
right_adjoint_preserves_mono (adjunction.of_right_adjoint F) h
65-
66-
lemma faithful_reflects_epi (F : C ⥤ D) [faithful F] {X Y : C} {f : X ⟶ Y}
67-
(hf : epi (F.map f)) : epi f :=
68-
⟨λ Z g h H, F.map_injective $
69-
by rw [←cancel_epi (F.map f), ←F.map_comp, ←F.map_comp, H]⟩
70-
71-
lemma faithful_reflects_mono (F : C ⥤ D) [faithful F] {X Y : C} {f : X ⟶ Y}
72-
(hf : mono (F.map f)) : mono f :=
73-
⟨λ Z g h H, F.map_injective $
74-
by rw [←cancel_mono (F.map f), ←F.map_comp, ←F.map_comp, H]⟩
75-
end
76-
7735
/--
7836
A split monomorphism is a morphism `f : X ⟶ Y` admitting a retraction `retraction f : Y ⟶ X`
7937
such that `f ≫ retraction f = 𝟙 X`.
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
/-
2+
Copyright (c) 2022 Markus Himmel. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Markus Himmel
5+
-/
6+
import category_theory.epi_mono
7+
8+
/-!
9+
# Preservation and reflection of monomorphisms and epimorphisms
10+
11+
We provide typeclasses that state that a functor preserves or reflects monomorphisms or
12+
epimorphisms.
13+
-/
14+
15+
open category_theory
16+
17+
universes v₁ v₂ v₃ u₁ u₂ u₃
18+
19+
namespace category_theory.functor
20+
variables {C : Type u₁} [category.{v₁} C] {D : Type u₂} [category.{v₂} D]
21+
{E : Type u₃} [category.{v₃} E]
22+
23+
/-- A functor preserves monomorphisms if it maps monomorphisms to monomorphisms. -/
24+
class preserves_monomorphisms (F : C ⥤ D) : Prop :=
25+
(preserves : ∀ {X Y : C} (f : X ⟶ Y) [mono f], mono (F.map f))
26+
27+
instance map_mono (F : C ⥤ D) [preserves_monomorphisms F] {X Y : C} (f : X ⟶ Y) [mono f] :
28+
mono (F.map f) :=
29+
preserves_monomorphisms.preserves f
30+
31+
/-- A functor preserves epimorphisms if it maps epimorphisms to epimorphisms. -/
32+
class preserves_epimorphisms (F : C ⥤ D) : Prop :=
33+
(preserves : ∀ {X Y : C} (f : X ⟶ Y) [epi f], epi (F.map f))
34+
35+
instance map_epi (F : C ⥤ D) [preserves_epimorphisms F] {X Y : C} (f : X ⟶ Y) [epi f] :
36+
epi (F.map f) :=
37+
preserves_epimorphisms.preserves f
38+
39+
/-- A functor reflects monomorphisms if morphisms that are mapped to monomorphisms are themselves
40+
monomorphisms. -/
41+
class reflects_monomorphisms (F : C ⥤ D) : Prop :=
42+
(reflects : ∀ {X Y : C} (f : X ⟶ Y), mono (F.map f) → mono f)
43+
44+
lemma mono_of_mono_map (F : C ⥤ D) [reflects_monomorphisms F] {X Y : C} {f : X ⟶ Y}
45+
(h : mono (F.map f)) : mono f :=
46+
reflects_monomorphisms.reflects f h
47+
48+
/-- A functor reflects epimorphisms if morphisms that are mapped to epimorphisms are themselves
49+
epimorphisms. -/
50+
class reflects_epimorphisms (F : C ⥤ D) : Prop :=
51+
(reflects : ∀ {X Y : C} (f : X ⟶ Y), epi (F.map f) → epi f)
52+
53+
lemma epi_of_epi_map (F : C ⥤ D) [reflects_epimorphisms F] {X Y : C} {f : X ⟶ Y}
54+
(h : epi (F.map f)) : epi f :=
55+
reflects_epimorphisms.reflects f h
56+
57+
instance preserves_monomorphisms_comp (F : C ⥤ D) (G : D ⥤ E) [preserves_monomorphisms F]
58+
[preserves_monomorphisms G] : preserves_monomorphisms (F ⋙ G) :=
59+
{ preserves := λ X Y f h, by { rw comp_map, exactI infer_instance } }
60+
61+
instance preserves_epimorphisms_comp (F : C ⥤ D) (G : D ⥤ E) [preserves_epimorphisms F]
62+
[preserves_epimorphisms G] : preserves_epimorphisms (F ⋙ G) :=
63+
{ preserves := λ X Y f h, by { rw comp_map, exactI infer_instance } }
64+
65+
instance reflects_monomorphisms_comp (F : C ⥤ D) (G : D ⥤ E) [reflects_monomorphisms F]
66+
[reflects_monomorphisms G] : reflects_monomorphisms (F ⋙ G) :=
67+
{ reflects := λ X Y f h, (F.mono_of_mono_map (G.mono_of_mono_map h)) }
68+
69+
instance reflects_epimorphisms_comp (F : C ⥤ D) (G : D ⥤ E) [reflects_epimorphisms F]
70+
[reflects_epimorphisms G] : reflects_epimorphisms (F ⋙ G) :=
71+
{ reflects := λ X Y f h, (F.epi_of_epi_map (G.epi_of_epi_map h)) }
72+
73+
lemma preserves_monomorphisms.of_iso {F G : C ⥤ D} [preserves_monomorphisms F] (α : F ≅ G) :
74+
preserves_monomorphisms G :=
75+
{ preserves := λ X Y f h,
76+
begin
77+
haveI : mono (F.map f ≫ (α.app Y).hom) := by exactI mono_comp _ _,
78+
convert (mono_comp _ _ : mono ((α.app X).inv ≫ F.map f ≫ (α.app Y).hom)),
79+
rw [iso.eq_inv_comp, iso.app_hom, iso.app_hom, nat_trans.naturality]
80+
end }
81+
82+
lemma preserves_monomorphisms.iso_iff {F G : C ⥤ D} (α : F ≅ G) :
83+
preserves_monomorphisms F ↔ preserves_monomorphisms G :=
84+
⟨λ h, by exactI preserves_monomorphisms.of_iso α,
85+
λ h, by exactI preserves_monomorphisms.of_iso α.symm⟩
86+
87+
lemma preserves_epimorphisms.of_iso {F G : C ⥤ D} [preserves_epimorphisms F] (α : F ≅ G) :
88+
preserves_epimorphisms G :=
89+
{ preserves := λ X Y f h,
90+
begin
91+
haveI : epi (F.map f ≫ (α.app Y).hom) := by exactI epi_comp _ _,
92+
convert (epi_comp _ _ : epi ((α.app X).inv ≫ F.map f ≫ (α.app Y).hom)),
93+
rw [iso.eq_inv_comp, iso.app_hom, iso.app_hom, nat_trans.naturality]
94+
end }
95+
96+
lemma preserves_epimorphisms.iso_iff {F G : C ⥤ D} (α : F ≅ G) :
97+
preserves_epimorphisms F ↔ preserves_epimorphisms G :=
98+
⟨λ h, by exactI preserves_epimorphisms.of_iso α,
99+
λ h, by exactI preserves_epimorphisms.of_iso α.symm⟩
100+
101+
lemma reflects_monomorphisms.of_iso {F G : C ⥤ D} [reflects_monomorphisms F] (α : F ≅ G) :
102+
reflects_monomorphisms G :=
103+
{ reflects := λ X Y f h,
104+
begin
105+
apply F.mono_of_mono_map,
106+
haveI : mono (G.map f ≫ (α.app Y).inv) := by exactI mono_comp _ _,
107+
convert (mono_comp _ _ : mono ((α.app X).hom ≫ G.map f ≫ (α.app Y).inv)),
108+
rw [← category.assoc, iso.eq_comp_inv, iso.app_hom, iso.app_hom, nat_trans.naturality]
109+
end }
110+
111+
lemma reflects_monomorphisms.iso_iff {F G : C ⥤ D} (α : F ≅ G) :
112+
reflects_monomorphisms F ↔ reflects_monomorphisms G :=
113+
⟨λ h, by exactI reflects_monomorphisms.of_iso α,
114+
λ h, by exactI reflects_monomorphisms.of_iso α.symm⟩
115+
116+
lemma reflects_epimorphisms.of_iso {F G : C ⥤ D} [reflects_epimorphisms F] (α : F ≅ G) :
117+
reflects_epimorphisms G :=
118+
{ reflects := λ X Y f h,
119+
begin
120+
apply F.epi_of_epi_map,
121+
haveI : epi (G.map f ≫ (α.app Y).inv) := by exactI epi_comp _ _,
122+
convert (epi_comp _ _ : epi ((α.app X).hom ≫ G.map f ≫ (α.app Y).inv)),
123+
rw [← category.assoc, iso.eq_comp_inv, iso.app_hom, iso.app_hom, nat_trans.naturality]
124+
end }
125+
126+
lemma reflects_epimorphisms.iso_iff {F G : C ⥤ D} (α : F ≅ G) :
127+
reflects_epimorphisms F ↔ reflects_epimorphisms G :=
128+
⟨λ h, by exactI reflects_epimorphisms.of_iso α, λ h, by exactI reflects_epimorphisms.of_iso α.symm⟩
129+
130+
lemma preserves_epimorphsisms_of_adjunction {F : C ⥤ D} {G : D ⥤ C} (adj : F ⊣ G) :
131+
preserves_epimorphisms F :=
132+
{ preserves := λ X Y f hf,
133+
begin
134+
introsI Z g h H,
135+
replace H := congr_arg (adj.hom_equiv X Z) H,
136+
rwa [adj.hom_equiv_naturality_left, adj.hom_equiv_naturality_left, cancel_epi,
137+
equiv.apply_eq_iff_eq] at H
138+
end⟩ }
139+
140+
@[priority 100]
141+
instance preserves_epimorphisms_of_is_left_adjoint (F : C ⥤ D) [is_left_adjoint F] :
142+
preserves_epimorphisms F :=
143+
preserves_epimorphsisms_of_adjunction (adjunction.of_left_adjoint F)
144+
145+
lemma preserves_monomorphisms_of_adjunction {F : C ⥤ D} {G : D ⥤ C} (adj : F ⊣ G) :
146+
preserves_monomorphisms G :=
147+
{ preserves := λ X Y f hf,
148+
begin
149+
introsI Z g h H,
150+
replace H := congr_arg (adj.hom_equiv Z Y).symm H,
151+
rwa [adj.hom_equiv_naturality_right_symm, adj.hom_equiv_naturality_right_symm,
152+
cancel_mono, equiv.apply_eq_iff_eq] at H
153+
end⟩ }
154+
155+
@[priority 100]
156+
instance preserves_monomorphisms_of_is_right_adjoint (F : C ⥤ D) [is_right_adjoint F] :
157+
preserves_monomorphisms F :=
158+
preserves_monomorphisms_of_adjunction (adjunction.of_right_adjoint F)
159+
160+
@[priority 100]
161+
instance reflects_monomorphisms_of_faithful (F : C ⥤ D) [faithful F] : reflects_monomorphisms F :=
162+
{ reflects := λ X Y f hf, ⟨λ Z g h hgh, by exactI F.map_injective ((cancel_mono (F.map f)).1
163+
(by rw [← F.map_comp, hgh, F.map_comp]))⟩ }
164+
165+
@[priority 100]
166+
instance reflects_epimorphisms_of_faithful (F : C ⥤ D) [faithful F] : reflects_epimorphisms F :=
167+
{ reflects := λ X Y f hf, ⟨λ Z g h hgh, by exactI F.map_injective ((cancel_epi (F.map f)).1
168+
(by rw [← F.map_comp, hgh, F.map_comp]))⟩ }
169+
170+
end category_theory.functor

src/category_theory/glue_data.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ instance (i j k : D.J) : has_pullback (F.map (D.f i j)) (F.map (D.f i k)) :=
199199
U := λ i, F.obj (D.U i),
200200
V := λ i, F.obj (D.V i),
201201
f := λ i j, F.map (D.f i j),
202-
f_mono := λ i j, category_theory.preserves_mono F (D.f i j),
202+
f_mono := λ i j, preserves_mono_of_preserves_limit _ _,
203203
f_id := λ i, infer_instance,
204204
t := λ i j, F.map (D.t i j),
205205
t_id := λ i, by { rw D.t_id i, simp },

0 commit comments

Comments
 (0)