module Algebra.Group.Ab where
Abelian groupsπ
A very important class of groups (which includes most familiar examples of groups: the integers, all finite cyclic groups, etc) are those with a commutative group operation, that is, those for which Accordingly, these have a name reflecting their importance and ubiquity: They are called commutative groups. Just kidding! Theyβre named abelian groups, named after a person, because nothing can have self-explicative names in mathematics. Itβs the law.
private variable β : Level G : Type β Group-on-is-abelian : Group-on G β Type _ Group-on-is-abelian G = β x y β Group-on._β_ G x y β‘ Group-on._β_ G y x Group-on-is-abelian-is-prop : (g : Group-on G) β is-prop (Group-on-is-abelian g) Group-on-is-abelian-is-prop g = Ξ -is-hlevelΒ² 1 Ξ» _ _ β g .Group-on.has-is-set _ _
This module does the usual algebraic structure dance to set up the category of Abelian groups.
record is-abelian-group (_*_ : G β G β G) : Type (level-of G) where no-eta-equality field has-is-group : is-group _*_ commutes : β {x y} β x * y β‘ y * x open is-group has-is-group renaming (unit to 1g) public
equal-sumβequal-diff : β a b c d β a * b β‘ c * d β a β c β‘ d β b equal-sumβequal-diff a b c d p = commutes β swizzle p inverser inversel
private unquoteDecl eqv = declare-record-iso eqv (quote is-abelian-group) instance H-Level-is-abelian-group : β {n} {* : G β G β G} β H-Level (is-abelian-group *) (suc n) H-Level-is-abelian-group = prop-instance $ Isoβis-hlevel 1 eqv $ Ξ£-is-hlevel 1 (hlevel 1) Ξ» x β Ξ -is-hlevelΒ²' 1 Ξ» _ _ β is-group.has-is-set x _ _
record Abelian-group-on (T : Type β) : Type β where no-eta-equality field _*_ : T β T β T has-is-ab : is-abelian-group _*_ open is-abelian-group has-is-ab renaming (inverse to infixl 30 _β»ΒΉ) public
AbelianβGroup-on : Group-on T AbelianβGroup-on .Group-on._β_ = _*_ AbelianβGroup-on .Group-on.has-is-group = has-is-group AbelianβGroup-on-abelian : Group-on-is-abelian AbelianβGroup-on AbelianβGroup-on-abelian _ _ = commutes infixr 20 _*_ open Abelian-group-on using (AbelianβGroup-on; AbelianβGroup-on-abelian) public
Abelian-group-structure : β β β Thin-structure β Abelian-group-on β£ Abelian-group-structure β .is-hom f Gβ Gβ β£ = is-group-hom (AbelianβGroup-on Gβ) (AbelianβGroup-on Gβ) f Abelian-group-structure β .is-hom f Gβ Gβ .is-tr = hlevel 1 Abelian-group-structure β .id-is-hom .is-group-hom.pres-β x y = refl Abelian-group-structure β .β-is-hom f g Ξ± Ξ² .is-group-hom.pres-β x y = ap f (Ξ² .is-group-hom.pres-β x y) β Ξ± .is-group-hom.pres-β (g x) (g y) Abelian-group-structure β .id-hom-unique {s = s} {t} Ξ± _ = p where open Abelian-group-on p : s β‘ t p i ._*_ x y = Ξ± .is-group-hom.pres-β x y i p i .has-is-ab = is-propβpathp (Ξ» i β hlevel {T = is-abelian-group (Ξ» x y β p i ._*_ x y)} 1) (s .has-is-ab) (t .has-is-ab) i Ab : β β β Precategory (lsuc β) β Ab β = Structured-objects (Abelian-group-structure β) module Ab {β} = Cat.Reasoning (Ab β) instance Ab-equational : β {β} β is-equational (Abelian-group-structure β) Ab-equational .is-equational.invert-id-hom = Groups-equational .is-equational.invert-id-hom
Abelian-group : (β : Level) β Type (lsuc β) Abelian-group _ = Ab.Ob AbelianβGroup : β {β} β Abelian-group β β Group β AbelianβGroup G = G .fst , AbelianβGroup-on (G .snd) record make-abelian-group (T : Type β) : Type β where no-eta-equality field ab-is-set : is-set T mul : T β T β T inv : T β T 1g : T idl : β x β mul 1g x β‘ x assoc : β x y z β mul x (mul y z) β‘ mul (mul x y) z invl : β x β mul (inv x) x β‘ 1g comm : β x y β mul x y β‘ mul y x make-abelian-groupβmake-group : make-group T make-abelian-groupβmake-group = mg where mg : make-group T mg .make-group.group-is-set = ab-is-set mg .make-group.unit = 1g mg .make-group.mul = mul mg .make-group.inv = inv mg .make-group.assoc = assoc mg .make-group.invl = invl mg .make-group.idl = idl to-group-on-ab : Group-on T to-group-on-ab = to-group-on make-abelian-groupβmake-group to-abelian-group-on : Abelian-group-on T to-abelian-group-on .Abelian-group-on._*_ = mul to-abelian-group-on .Abelian-group-on.has-is-ab .is-abelian-group.has-is-group = Group-on.has-is-group to-group-on-ab to-abelian-group-on .Abelian-group-on.has-is-ab .is-abelian-group.commutes = comm _ _ to-ab : Abelian-group β β£ to-ab .fst β£ = T to-ab .fst .is-tr = ab-is-set to-ab .snd = to-abelian-group-on is-commutative-group : β {β} β Group β β Type β is-commutative-group G = Group-on-is-abelian (G .snd) from-commutative-group : β {β} (G : Group β) β is-commutative-group G β Abelian-group β from-commutative-group G comm .fst = G .fst from-commutative-group G comm .snd .Abelian-group-on._*_ = Group-on._β_ (G .snd) from-commutative-group G comm .snd .Abelian-group-on.has-is-ab .is-abelian-group.has-is-group = Group-on.has-is-group (G .snd) from-commutative-group G comm .snd .Abelian-group-on.has-is-ab .is-abelian-group.commutes = comm _ _ GrpβAbβGrp : β {β} (G : Group β) (c : is-commutative-group G) β AbelianβGroup (from-commutative-group G c) β‘ G GrpβAbβGrp G c = Ξ£-pathp refl go where go : AbelianβGroup-on (from-commutative-group G c .snd) β‘ G .snd go i .Group-on._β_ = G .snd .Group-on._β_ go i .Group-on.has-is-group = G .snd .Group-on.has-is-group open make-abelian-group using (make-abelian-groupβmake-group ; to-group-on-ab ; to-abelian-group-on ; to-ab) public open Functor AbβͺGrp : β {β} β Functor (Ab β) (Groups β) AbβͺGrp .Fβ = AbelianβGroup AbβͺGrp .Fβ f .hom = f .hom AbβͺGrp .Fβ f .preserves = f .preserves AbβͺGrp .F-id = trivial! AbβͺGrp .F-β f g = trivial! AbβͺGrp-is-ff : β {β} β is-fully-faithful (AbβͺGrp {β}) AbβͺGrp-is-ff {x = A} {B} = is-isoβis-equiv $ iso promote (Ξ» _ β trivial!) (Ξ» _ β trivial!) where promote : Groups.Hom (AbelianβGroup A) (AbelianβGroup B) β Ab.Hom A B promote f .hom = f .hom promote f .preserves = f .preserves AbβͺSets : β {β} β Functor (Ab β) (Sets β) AbβͺSets = GrpβͺSets Fβ AbβͺGrp
The fundamental example of an abelian group is the group of integers.
Given an abelian group we can define the negation automorphism which inverts every element: since the group operation is commutative, we have so this is a homomorphism.
negation : G Ab.β G negation = total-iso (_β»ΒΉ , is-involutiveβis-equiv (Ξ» _ β inv-inv)) (record { pres-β = Ξ» x y β inv-comm β commutes })