Skip to content

Commit 4773f92

Browse files
MultramateTwoFXmo271adamtopaznick-kuhn
committed
feat(Algebra/Category/GroupCat/Abelian): prove AddCommGroupCat is AB5 (#5597)
This work was done during the 2023 Copenhagen masterclass on formalisation of condensed mathematics. Numerous participants contributed. Co-authored-by: Moritz Firsching <moritz.firsching@gmail.com> Co-authored-by: Nikolas Kuhn <nikolaskuhn@gmx.de> Co-authored-by: Amelia Livingston <101damnations@github.com> Co-authored-by: Markus Himmel <markus@himmel-villmar.de> Co-authored-by: Moritz Firsching <firsching@google.com> Co-authored-by: adamtopaz <github@adamtopaz.com> Co-authored-by: nick-kuhn <nikolaskuhn@gmx.de>
1 parent 275e357 commit 4773f92

File tree

6 files changed

+103
-21
lines changed

6 files changed

+103
-21
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import Mathlib.Algebra.Category.GroupCat.EquivalenceGroupAddGroup
4747
import Mathlib.Algebra.Category.GroupCat.FilteredColimits
4848
import Mathlib.Algebra.Category.GroupCat.Images
4949
import Mathlib.Algebra.Category.GroupCat.Injective
50+
import Mathlib.Algebra.Category.GroupCat.Kernels
5051
import Mathlib.Algebra.Category.GroupCat.Limits
5152
import Mathlib.Algebra.Category.GroupCat.Preadditive
5253
import Mathlib.Algebra.Category.GroupCat.Subobject

Mathlib/Algebra/Category/GroupCat/Abelian.lean

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,30 @@ Copyright (c) 2020 Markus Himmel. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Markus Himmel
55
-/
6-
import Mathlib.Algebra.Category.GroupCat.ZModuleEquivalence
7-
import Mathlib.Algebra.Category.GroupCat.Limits
86
import Mathlib.Algebra.Category.GroupCat.Colimits
7+
import Mathlib.Algebra.Category.GroupCat.FilteredColimits
8+
import Mathlib.Algebra.Category.GroupCat.Kernels
9+
import Mathlib.Algebra.Category.GroupCat.Limits
10+
import Mathlib.Algebra.Category.GroupCat.ZModuleEquivalence
911
import Mathlib.Algebra.Category.ModuleCat.Abelian
10-
import Mathlib.CategoryTheory.Abelian.Basic
12+
import Mathlib.CategoryTheory.Abelian.FunctorCategory
13+
import Mathlib.CategoryTheory.Limits.ConcreteCategory
1114

1215
#align_import algebra.category.Group.abelian from "leanprover-community/mathlib"@"f7baecbb54bd0f24f228576f97b1752fc3c9b318"
1316

1417
/-!
1518
# The category of abelian groups is abelian
1619
-/
1720

18-
19-
open CategoryTheory
20-
21-
open CategoryTheory.Limits
21+
open CategoryTheory Limits
2222

2323
universe u
2424

2525
noncomputable section
2626

2727
namespace AddCommGroupCat
2828

29-
section
30-
31-
variable {X Y : AddCommGroupCat.{u}} (f : X ⟶ Y)
29+
variable {X Y Z : AddCommGroupCat.{u}} (f : X ⟶ Y) (g : Y ⟶ Z)
3230

3331
/-- In the category of abelian groups, every monomorphism is normal. -/
3432
def normalMono (_ : Mono f) : NormalMono f :=
@@ -44,18 +42,38 @@ def normalEpi (_ : Epi f) : NormalEpi f :=
4442
set_option linter.uppercaseLean3 false in
4543
#align AddCommGroup.normal_epi AddCommGroupCat.normalEpi
4644

47-
end
48-
4945
/-- The category of abelian groups is abelian. -/
5046
instance : Abelian AddCommGroupCat.{u} where
51-
has_finite_products := ⟨by infer_instance
47+
has_finite_products := ⟨HasFiniteProducts.out
5248
normalMonoOfMono := normalMono
5349
normalEpiOfEpi := normalEpi
54-
add_comp := by
55-
intros
56-
simp only [Preadditive.add_comp]
57-
comp_add := by
58-
intros
59-
simp only [Preadditive.comp_add]
50+
51+
theorem exact_iff : Exact f g ↔ f.range = g.ker := by
52+
rw [Abelian.exact_iff' f g (kernelIsLimit _) (cokernelIsColimit _)]
53+
exact
54+
fun h => ((AddMonoidHom.range_le_ker_iff _ _).mpr h.left).antisymm
55+
((QuotientAddGroup.ker_le_range_iff _ _).mpr h.right),
56+
fun h => ⟨(AddMonoidHom.range_le_ker_iff _ _).mp h.le,
57+
(QuotientAddGroup.ker_le_range_iff _ _).mp h.symm.le⟩⟩
58+
59+
/-- The category of abelian groups satisfies Grothedieck's Axiom AB5. -/
60+
instance {J : Type u} [SmallCategory J] [IsFiltered J] :
61+
PreservesFiniteLimits <| colim (J := J) (C := AddCommGroupCat.{u}) := by
62+
refine Functor.preservesFiniteLimitsOfMapExact _
63+
fun F G H η γ h => (exact_iff _ _).mpr (le_antisymm ?_ ?_)
64+
all_goals replace h : ∀ j : J, Exact (η.app j) (γ.app j) :=
65+
fun j => Functor.map_exact ((evaluation _ _).obj j) η γ h
66+
· rw [AddMonoidHom.range_le_ker_iff, ← comp_def]
67+
exact colimit.hom_ext fun j => by simp [reassoc_of% (h j).w]
68+
· intro x (hx : _ = _)
69+
rcases Concrete.colimit_exists_rep G x with ⟨j, y, rfl⟩
70+
erw [← comp_apply, colimit.ι_map, comp_apply,
71+
← map_zero (by exact colimit.ι H j : H.obj j →+ ↑(colimit H))] at hx
72+
rcases Concrete.colimit_exists_of_rep_eq H _ _ hx with ⟨k, e₁, e₂, hk : _ = H.map e₂ 0
73+
rw [map_zero, ← comp_apply, ← NatTrans.naturality, comp_apply] at hk
74+
rcases ((exact_iff _ _).mp <| h k).ge hk with ⟨t, ht⟩
75+
use colimit.ι F k t
76+
erw [← comp_apply, colimit.ι_map, comp_apply, ht]
77+
exact colimit.w_apply G e₁ y
6078

6179
end AddCommGroupCat

Mathlib/Algebra/Category/GroupCat/Basic.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ lemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl
7474
@[to_additive (attr := simp)]
7575
lemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl
7676

77+
@[to_additive]
78+
lemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl
79+
7780
-- porting note: added
7881
@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl
7982

@@ -220,6 +223,9 @@ lemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl
220223
@[to_additive (attr := simp)]
221224
lemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl
222225

226+
@[to_additive]
227+
lemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl
228+
223229
-- porting note: added
224230
@[to_additive (attr := simp)]
225231
lemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/-
2+
Copyright (c) 2023 Moritz Firsching. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: David Kurniadi Angdinata, Moritz Firsching, Nikolas Kuhn
5+
-/
6+
import Mathlib.Algebra.Category.GroupCat.EpiMono
7+
import Mathlib.Algebra.Category.GroupCat.Preadditive
8+
import Mathlib.CategoryTheory.Limits.Shapes.Kernels
9+
10+
/-!
11+
# The concrete (co)kernels in the category of abelian groups are categorical (co)kernels.
12+
-/
13+
14+
namespace AddCommGroupCat
15+
16+
open AddMonoidHom CategoryTheory Limits QuotientAddGroup
17+
18+
universe u
19+
20+
variable {G H : AddCommGroupCat.{u}} (f : G ⟶ H)
21+
22+
/-- The kernel cone induced by the concrete kernel. -/
23+
def kernelCone : KernelFork f :=
24+
KernelFork.ofι (Z := of f.ker) f.ker.subtype <| ext fun x => x.casesOn fun _ hx => hx
25+
26+
/-- The kernel of a group homomorphism is a kernel in the categorical sense. -/
27+
def kernelIsLimit : IsLimit <| kernelCone f :=
28+
Fork.IsLimit.mk _
29+
(fun s => (by exact Fork.ι s : _ →+ G).codRestrict _ <| fun c => f.mem_ker.mpr <|
30+
by exact FunLike.congr_fun s.condition c)
31+
(fun _ => by rfl)
32+
(fun _ _ h => ext fun x => Subtype.ext_iff_val.mpr <| by exact FunLike.congr_fun h x)
33+
34+
/-- The cokernel cocone induced by the projection onto the quotient. -/
35+
def cokernelCocone : CokernelCofork f :=
36+
CokernelCofork.ofπ (Z := of <| H ⧸ f.range) (mk' f.range) <| ext fun x =>
37+
(eq_zero_iff _).mpr ⟨x, rfl⟩
38+
39+
/-- The projection onto the quotient is a cokernel in the categorical sense. -/
40+
def cokernelIsColimit : IsColimit <| cokernelCocone f :=
41+
Cofork.IsColimit.mk _
42+
(fun s => lift _ _ <| (range_le_ker_iff _ _).mpr <| CokernelCofork.condition s)
43+
(fun _ => rfl)
44+
(fun _ _ h => have : Epi (cokernelCocone f).π := (epi_iff_surjective _).mpr <| mk'_surjective _
45+
(cancel_epi _).mp <| by simpa only [parallelPair_obj_one] using h)
46+
47+
end AddCommGroupCat

Mathlib/GroupTheory/QuotientGroup.lean

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ isomorphism theorems, quotient groups
4444

4545
open Function
4646

47-
universe u v
47+
universe u v w
4848

4949
namespace QuotientGroup
5050

@@ -122,6 +122,12 @@ theorem eq_one_iff {N : Subgroup G} [nN : N.Normal] (x : G) : (x : G ⧸ N) = 1
122122
#align quotient_group.eq_one_iff QuotientGroup.eq_one_iff
123123
#align quotient_add_group.eq_zero_iff QuotientAddGroup.eq_zero_iff
124124

125+
@[to_additive]
126+
theorem ker_le_range_iff {I : Type w} [Group I] (f : G →* H) [f.range.Normal] (g : H →* I) :
127+
g.ker ≤ f.range ↔ (mk' f.range).comp g.ker.subtype = 1 :=
128+
fun h => MonoidHom.ext fun ⟨_, hx⟩ => (eq_one_iff _).mpr <| h hx,
129+
fun h x hx => (eq_one_iff _).mp <| by exact FunLike.congr_fun h ⟨x, hx⟩⟩
130+
125131
@[to_additive (attr := simp)]
126132
theorem ker_mk' : MonoidHom.ker (QuotientGroup.mk' N : G →* G ⧸ N) = N :=
127133
Subgroup.ext eq_one_iff

Mathlib/GroupTheory/Subgroup/Basic.lean

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ subgroup, subgroups
8989
open Function
9090
open Int
9191

92-
variable {G G' : Type _} [Group G] [Group G']
92+
variable {G G' G'' : Type _} [Group G] [Group G'] [Group G'']
9393

9494
variable {A : Type _} [AddGroup A]
9595

@@ -2869,6 +2869,10 @@ theorem ker_prodMap {G' : Type _} {N' : Type _} [Group G'] [Group N'] (f : G →
28692869
#align monoid_hom.ker_prod_map MonoidHom.ker_prodMap
28702870
#align add_monoid_hom.ker_sum_map AddMonoidHom.ker_sumMap
28712871

2872+
@[to_additive]
2873+
theorem range_le_ker_iff (f : G →* G') (g : G' →* G'') : f.range ≤ g.ker ↔ g.comp f = 1 :=
2874+
fun h => ext fun x => h ⟨x, rfl⟩, by rintro h _ ⟨y, rfl⟩; exact FunLike.congr_fun h y⟩
2875+
28722876
@[to_additive]
28732877
instance (priority := 100) normal_ker (f : G →* M) : f.ker.Normal :=
28742878
fun x hx y => by

0 commit comments

Comments
 (0)