Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat(Algebra/Category/GroupCat/Abelian): prove AddCommGroupCat is AB5 #5597

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
e419e45
Copy from LTE
Multramate Jun 28, 2023
d70e5af
Push more code
Multramate Jun 28, 2023
67da821
fix first part
mo271 Jun 28, 2023
27d7048
fix exact_iff'
mo271 Jun 28, 2023
ba0d3dc
avoid deprecated congr_fun
mo271 Jun 28, 2023
a579735
wip
mo271 Jun 28, 2023
e66855b
wip
mo271 Jun 29, 2023
7e756c5
fix
adamtopaz Jun 29, 2023
2e80cf5
wip
mo271 Jun 30, 2023
97f4cd1
add kernels
mo271 Jun 30, 2023
1401fa5
kernelCone
nick-kuhn Jun 30, 2023
2d83b2d
fix kernelCone
mo271 Jun 30, 2023
37f0bbf
Update Kernels.lean
Multramate Jun 30, 2023
d8e0294
Update Kernels.lean
Multramate Jun 30, 2023
8b0987e
Update Kernels.lean
Multramate Jun 30, 2023
c1fff53
First part cokernelIsColimit
nick-kuhn Jun 30, 2023
fa0bcfe
Update Kernels.lean
Multramate Jun 30, 2023
15b2959
range_le_ker_iff
mo271 Jun 30, 2023
a46ce48
less aesop_cat
mo271 Jun 30, 2023
fef709a
golfed first part
mo271 Jun 30, 2023
a2a714d
cokernelIsColimit
nick-kuhn Jun 30, 2023
65780ca
Merge branch 'AB5' of https://github.com/leanprover-community/mathlib…
nick-kuhn Jun 30, 2023
d6daef3
add import
mo271 Jun 30, 2023
64a9d01
Updated exact_iff
nick-kuhn Jun 30, 2023
43571fa
Added Variables
nick-kuhn Jun 30, 2023
e7b76b3
added statement for ker_le_range_iff
mo271 Jun 30, 2023
b10c034
Update Kernels.lean
Multramate Jun 30, 2023
b90afa8
one direction
mo271 Jun 30, 2023
e8d0c40
Update Abelian.lean
Multramate Jun 30, 2023
d1f0420
Update Kernels.lean
Multramate Jun 30, 2023
f637f6a
Prove AB5 assuming exact_of_exact_functor
Multramate Jun 30, 2023
06547aa
Fix minor documentation issues
Multramate Jun 30, 2023
2b83b1c
Prove exact_of_exact_functor
Multramate Jul 10, 2023
7b731ff
Relocate theorems
Multramate Jul 10, 2023
d356d4b
Concretise range_le_ker_iff and ker_le_range_iff
Multramate Jul 29, 2023
84dbf49
Fix qualifiers
Multramate Jul 29, 2023
902771c
Refactor exact_iff'
Multramate Jul 30, 2023
b0c73bc
Merge remote-tracking branch 'origin/master' into AB5
TwoFX Jul 31, 2023
2de9ecb
fix
TwoFX Jul 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Mathlib.lean
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import Mathlib.Algebra.Category.GroupCat.EquivalenceGroupAddGroup
import Mathlib.Algebra.Category.GroupCat.FilteredColimits
import Mathlib.Algebra.Category.GroupCat.Images
import Mathlib.Algebra.Category.GroupCat.Injective
import Mathlib.Algebra.Category.GroupCat.Kernels
import Mathlib.Algebra.Category.GroupCat.Limits
import Mathlib.Algebra.Category.GroupCat.Preadditive
import Mathlib.Algebra.Category.GroupCat.Subobject
Expand Down
62 changes: 43 additions & 19 deletions Mathlib/Algebra/Category/GroupCat/Abelian.lean
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,28 @@ Authors: Markus Himmel
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathlib.Algebra.Category.GroupCat.ZModuleEquivalence
import Mathlib.Algebra.Category.GroupCat.Limits
import Mathlib.Algebra.Category.GroupCat.Colimits
import Mathlib.Algebra.Category.GroupCat.FilteredColimits
import Mathlib.Algebra.Category.GroupCat.Kernels
import Mathlib.Algebra.Category.GroupCat.Limits
import Mathlib.Algebra.Category.GroupCat.ZModuleEquivalence
import Mathlib.Algebra.Category.ModuleCat.Abelian
import Mathlib.CategoryTheory.Abelian.Basic
import Mathlib.CategoryTheory.Abelian.FunctorCategory
import Mathlib.CategoryTheory.Limits.ConcreteCategory

/-!
# The category of abelian groups is abelian
-/


open CategoryTheory

open CategoryTheory.Limits
open CategoryTheory Limits

universe u

noncomputable section

namespace AddCommGroupCat

section

variable {X Y : AddCommGroupCat.{u}} (f : X ⟶ Y)
variable {X Y Z : AddCommGroupCat.{u}} (f : X ⟶ Y) (g : Y ⟶ Z)

/-- In the category of abelian groups, every monomorphism is normal. -/
def normalMono (_ : Mono f) : NormalMono f :=
Expand All @@ -47,18 +45,44 @@ def normalEpi (_ : Epi f) : NormalEpi f :=
set_option linter.uppercaseLean3 false in
#align AddCommGroup.normal_epi AddCommGroupCat.normalEpi

end

/-- The category of abelian groups is abelian. -/
instance : Abelian AddCommGroupCat.{u} where
has_finite_products := ⟨by infer_instance
has_finite_products := ⟨HasFiniteProducts.out
normalMonoOfMono := normalMono
normalEpiOfEpi := normalEpi
add_comp := by
intros
simp only [Preadditive.add_comp]
comp_add := by
intros
simp only [Preadditive.comp_add]
add_comp := by exact Preadditive.add_comp
comp_add := by exact Preadditive.comp_add
Multramate marked this conversation as resolved.
Show resolved Hide resolved

theorem exact_iff : Exact f g ↔ f.range = g.ker := by
rw [Abelian.exact_iff' f g (kernelIsLimit _) (cokernelIsColimit _)]
exact
⟨fun h => ((AddMonoidHom.range_le_ker_iff _ _).mpr h.left).antisymm
((QuotientAddGroup.ker_le_range_iff _ _).mpr h.right),
fun h => ⟨(AddMonoidHom.range_le_ker_iff _ _).mp h.le,
(QuotientAddGroup.ker_le_range_iff _ _).mp h.symm.le⟩⟩

theorem exact_iff' : Exact f g ↔ f ≫ g = 0 ∧ g.ker ≤ f.range := by
TwoFX marked this conversation as resolved.
Show resolved Hide resolved
rw [exact_iff, le_antisymm_iff]
exact and_congr ⟨fun h => ext fun x => h (AddMonoidHom.mem_range.mpr ⟨x, rfl⟩),
by rintro h _ ⟨x, rfl⟩; exact FunLike.congr_fun h x⟩ Iff.rfl

/-- The category of abelian groups satisfies Grothedieck's Axiom AB5. -/
instance {J : Type u} [SmallCategory J] [IsFiltered J] :
PreservesFiniteLimits <| colim (J := J) (C := AddCommGroupCat.{u}) := by
refine Functor.preservesFiniteLimitsOfMapExact _ fun F G H η γ h => (exact_iff' _ _).mpr ?_
replace h : ∀ j : J, Exact (η.app j) (γ.app j) :=
fun j => Functor.map_exact ((evaluation _ _).obj j) η γ h
constructor
· exact colimit.hom_ext fun j => by simp [reassoc_of% (h j).w]
· intro x (hx : _ = _)
rcases Concrete.colimit_exists_rep G x with ⟨j, y, rfl⟩
erw [← comp_apply, colimit.ι_map, comp_apply,
← map_zero (by exact colimit.ι H j : H.obj j →+ ↑(colimit H))] at hx
rcases Concrete.colimit_exists_of_rep_eq H _ _ hx with ⟨k, e₁, e₂, hk : _ = H.map e₂ 0⟩
rw [map_zero, ← comp_apply, ← NatTrans.naturality, comp_apply] at hk
rcases ((exact_iff' _ _).mp <| h k).right hk with ⟨t, ht⟩
use colimit.ι F k t
erw [← comp_apply, colimit.ι_map, comp_apply, ht]
exact colimit.w_apply G e₁ y

end AddCommGroupCat
47 changes: 47 additions & 0 deletions Mathlib/Algebra/Category/GroupCat/Kernels.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/-
Copyright (c) 2023 Moritz Firsching. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Kurniadi Angdinata, Moritz Firsching, Nikolas Kuhn
-/
import Mathlib.Algebra.Category.GroupCat.EpiMono
import Mathlib.Algebra.Category.GroupCat.Preadditive
import Mathlib.CategoryTheory.Limits.Shapes.Kernels

/-!
# The concrete (co)kernels in the category of abelian groups are categorical (co)kernels.
-/

namespace AddCommGroupCat

open AddMonoidHom CategoryTheory Limits QuotientAddGroup

universe u

variable {G H : AddCommGroupCat.{u}} (f : G ⟶ H)

/-- The kernel cone induced by the concrete kernel. -/
def kernelCone : KernelFork f :=
KernelFork.ofι (Z := of f.ker) f.ker.subtype <| ext fun x => x.casesOn fun _ hx => hx

/-- The kernel of a group homomorphism is a kernel in the categorical sense. -/
def kernelIsLimit : IsLimit <| kernelCone f :=
Fork.IsLimit.mk _
(fun s => (by exact Fork.ι s : _ →+ G).codRestrict _ <| fun c => f.mem_ker.mpr <|
by exact FunLike.congr_fun s.condition c)
(fun _ => by rfl)
(fun _ _ h => ext fun x => Subtype.ext_iff_val.mpr <| by exact FunLike.congr_fun h x)

/-- The cokernel cocone induced by the projection onto the quotient. -/
def cokernelCocone : CokernelCofork f :=
CokernelCofork.ofπ (Z := of <| H ⧸ f.range) (mk' f.range) <| ext fun x =>
(eq_zero_iff _).mpr ⟨x, rfl⟩

/-- The projection onto the quotient is a cokernel in the categorical sense. -/
def cokernelIsColimit : IsColimit <| cokernelCocone f :=
Cofork.IsColimit.mk _
(fun s => lift _ _ <| (range_le_ker_iff _ _).mpr <| CokernelCofork.condition s)
(fun _ => rfl)
(fun _ _ h => have : Epi (cokernelCocone f).π := (epi_iff_surjective _).mpr <| mk'_surjective _
(cancel_epi _).mp <| by simpa only [parallelPair_obj_one] using h)

end AddCommGroupCat
8 changes: 7 additions & 1 deletion Mathlib/GroupTheory/QuotientGroup.lean
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ isomorphism theorems, quotient groups

open Function

universe u v
universe u v w

namespace QuotientGroup

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

@[to_additive]
theorem ker_le_range_iff {I : Type w} [Group I] (f : G →* H) [f.range.Normal] (g : H →* I) :
g.ker ≤ f.range ↔ (mk' f.range).comp g.ker.subtype = 1 :=
⟨fun h => MonoidHom.ext fun ⟨_, hx⟩ => (eq_one_iff _).mpr <| h hx,
fun h x hx => (eq_one_iff _).mp <| by exact FunLike.congr_fun h ⟨x, hx⟩⟩

@[to_additive (attr := simp)]
theorem ker_mk' : MonoidHom.ker (QuotientGroup.mk' N : G →* G ⧸ N) = N :=
Subgroup.ext eq_one_iff
Expand Down
6 changes: 5 additions & 1 deletion Mathlib/GroupTheory/Subgroup/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ subgroup, subgroups
open Function
open Int

variable {G G' : Type _} [Group G] [Group G']
variable {G G' G'' : Type _} [Group G] [Group G'] [Group G'']

variable {A : Type _} [AddGroup A]

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

@[to_additive]
theorem range_le_ker_iff (f : G →* G') (g : G' →* G'') : f.range ≤ g.ker ↔ g.comp f = 1 :=
⟨fun h => ext fun x => h ⟨x, rfl⟩, by rintro h _ ⟨y, rfl⟩; exact FunLike.congr_fun h y⟩

@[to_additive]
instance (priority := 100) normal_ker (f : G →* M) : f.ker.Normal :=
⟨fun x hx y => by
Expand Down