From 46d8280f1ac2dbc399b42d6a6becc1b31c543e5d Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Wed, 19 Nov 2025 13:26:47 +0000 Subject: [PATCH 01/16] add: `Centre` of an algebra, following #2863 --- CHANGELOG.md | 4 + src/Algebra/Construct/Centre/Center.agda | 49 ++++++++++++ src/Algebra/Construct/Centre/Group.agda | 85 +++++++++++++++++++++ src/Algebra/Construct/Centre/Monoid.agda | 66 ++++++++++++++++ src/Algebra/Construct/Centre/Semigroup.agda | 75 ++++++++++++++++++ 5 files changed, 279 insertions(+) create mode 100644 src/Algebra/Construct/Centre/Center.agda create mode 100644 src/Algebra/Construct/Centre/Group.agda create mode 100644 src/Algebra/Construct/Centre/Monoid.agda create mode 100644 src/Algebra/Construct/Centre/Semigroup.agda diff --git a/CHANGELOG.md b/CHANGELOG.md index 52fc3d6984..d30827c5b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,10 @@ Deprecated names New modules ----------- +* `Algebra.Construct.Centre.X` for the definition of the centre of an algebra, + where `X = {Semigroup|Monoid|Group}`, based on an underlying type defined in + `Algebra.Construct.Centre`. + * `Algebra.Construct.Sub.Group` for the definition of subgroups. * `Algebra.Module.Construct.Sub.Bimodule` for the definition of subbimodules. diff --git a/src/Algebra/Construct/Centre/Center.agda b/src/Algebra/Construct/Centre/Center.agda new file mode 100644 index 0000000000..cb8cfb3252 --- /dev/null +++ b/src/Algebra/Construct/Centre/Center.agda @@ -0,0 +1,49 @@ +------------------------------------------------------------------------ +-- The Agda standard library +-- +-- Definition of the centre as a subtype of (the carrier of) a raw magma +------------------------------------------------------------------------ + +{-# OPTIONS --safe --cubical-compatible #-} + +open import Algebra.Core using (Op₂) +open import Relation.Binary.Core using (Rel) + +module Algebra.Construct.Centre.Center + {c ℓ} {Carrier : Set c} (_∼_ : Rel Carrier ℓ) (_∙_ : Op₂ Carrier) + where + +open import Algebra.Definitions _∼_ using (Central) +open import Function.Base using (id; _on_) +open import Level using (_⊔_) +open import Relation.Binary.Morphism.Structures + using (IsRelHomomorphism; IsRelMonomorphism) + + +------------------------------------------------------------------------ +-- Definitions + +record Center : Set (c ⊔ ℓ) where + field + ι : Carrier + central : Central _∙_ ι + +open Center public + using (ι) + +∙-comm : ∀ g h → (ι g ∙ ι h) ∼ (ι h ∙ ι g) +∙-comm g h = Center.central g (ι h) + +-- Center as subtype of Carrier + +_≈_ : Rel Center _ +_≈_ = _∼_ on ι + +isRelHomomorphism : IsRelHomomorphism _≈_ _∼_ ι +isRelHomomorphism = record { cong = id } + +isRelMonomorphism : IsRelMonomorphism _≈_ _∼_ ι +isRelMonomorphism = record + { isHomomorphism = isRelHomomorphism + ; injective = id + } diff --git a/src/Algebra/Construct/Centre/Group.agda b/src/Algebra/Construct/Centre/Group.agda new file mode 100644 index 0000000000..745d2434bd --- /dev/null +++ b/src/Algebra/Construct/Centre/Group.agda @@ -0,0 +1,85 @@ +------------------------------------------------------------------------ +-- The Agda standard library +-- +-- Definition of the centre of an Algebra +------------------------------------------------------------------------ + +{-# OPTIONS --safe --cubical-compatible #-} + +open import Algebra.Bundles + using (Group; AbelianGroup; RawMonoid; RawGroup) + +module Algebra.Construct.Centre.Group {c ℓ} (group : Group c ℓ) where + +open import Algebra.Core using (Op₁) +open import Algebra.Morphism.Structures +open import Algebra.Morphism.GroupMonomorphism using (isGroup) +open import Function.Base using (id; const; _$_) + + +private + module G = Group group + +open import Relation.Binary.Reasoning.Setoid G.setoid as ≈-Reasoning +open import Algebra.Properties.Group group using (∙-cancelʳ) + + +------------------------------------------------------------------------ +-- Definition + +-- Re-export the underlying sub-Monoid + +open import Algebra.Construct.Centre.Monoid G.monoid as Z public + using (Center; ι; ∙-comm) + +-- Now, can define a commutative sub-Group + +_⁻¹ : Op₁ Center +g ⁻¹ = record + { ι = ι g G.⁻¹ + ; central = λ k → ∙-cancelʳ (ι g) _ _ $ begin + (ι g G.⁻¹ G.∙ k) G.∙ (ι g) ≈⟨ G.assoc _ _ _ ⟩ + ι g G.⁻¹ G.∙ (k G.∙ ι g) ≈⟨ G.∙-congˡ $ Center.central g k ⟨ + ι g G.⁻¹ G.∙ (ι g G.∙ k) ≈⟨ G.assoc _ _ _ ⟨ + (ι g G.⁻¹ G.∙ ι g) G.∙ k ≈⟨ G.∙-congʳ $ G.inverseˡ _ ⟩ + G.ε G.∙ k ≈⟨ Center.central Z.ε k ⟩ + k G.∙ G.ε ≈⟨ G.∙-congˡ $ G.inverseˡ _ ⟨ + k G.∙ (ι g G.⁻¹ G.∙ ι g) ≈⟨ G.assoc _ _ _ ⟨ + (k G.∙ ι g G.⁻¹) G.∙ (ι g) ∎ + } where open ≈-Reasoning + +domain : RawGroup _ _ +domain = record { RawMonoid Z.domain; _⁻¹ = _⁻¹ } + +isGroupHomomorphism : IsGroupHomomorphism domain G.rawGroup ι +isGroupHomomorphism = record + { isMonoidHomomorphism = Z.isMonoidHomomorphism + ; ⁻¹-homo = λ _ → G.refl + } + +isGroupMonomorphism : IsGroupMonomorphism domain G.rawGroup ι +isGroupMonomorphism = record + { isGroupHomomorphism = isGroupHomomorphism + ; injective = id + } + +abelianGroup : AbelianGroup _ _ +abelianGroup = record + { isAbelianGroup = record + { isGroup = isGroup isGroupMonomorphism G.isGroup + ; comm = ∙-comm + } + } + +Z[_] = abelianGroup + +{- + normalSubgroup : NormalSubgroup _ _ + normalSubgroup = record + { subgroup = record { ι-isGroupMonomorphism = isGroupMonomorphism } + ; normal = record + { conjugate = const + ; normal = Center.central + } + } +-} diff --git a/src/Algebra/Construct/Centre/Monoid.agda b/src/Algebra/Construct/Centre/Monoid.agda new file mode 100644 index 0000000000..d08dae966e --- /dev/null +++ b/src/Algebra/Construct/Centre/Monoid.agda @@ -0,0 +1,66 @@ +------------------------------------------------------------------------ +-- The Agda standard library +-- +-- Definition of the centre of an Monoid +------------------------------------------------------------------------ + +{-# OPTIONS --safe --cubical-compatible #-} + +open import Algebra.Bundles + using (Monoid; CommutativeMonoid; RawMagma; RawMonoid) + +module Algebra.Construct.Centre.Monoid + {c ℓ} (monoid : Monoid c ℓ) + where + +open import Algebra.Consequences.Setoid using (identity⇒central) +open import Algebra.Morphism.Structures +open import Algebra.Morphism.MonoidMonomorphism using (isMonoid) +open import Function.Base using (id) + +private + module G = Monoid monoid + + +------------------------------------------------------------------------ +-- Definition + +-- Re-export the underlying sub-Semigroup + +open import Algebra.Construct.Centre.Semigroup G.semigroup as Z public + using (Center; ι; ∙-comm) + +-- Now, can define a sub-Monoid + +ε : Center +ε = record + { ι = G.ε + ; central = identity⇒central G.setoid {_∙_ = G._∙_} G.identity + } + +domain : RawMonoid _ _ +domain = record { RawMagma Z.domain; ε = ε } + +isMonoidHomomorphism : IsMonoidHomomorphism domain G.rawMonoid ι +isMonoidHomomorphism = record + { isMagmaHomomorphism = Z.isMagmaHomomorphism + ; ε-homo = G.refl + } + +isMonoidMonomorphism : IsMonoidMonomorphism domain G.rawMonoid ι +isMonoidMonomorphism = record + { isMonoidHomomorphism = isMonoidHomomorphism + ; injective = id + } + +-- And hence a CommutativeMonoid + +commutativeMonoid : CommutativeMonoid _ _ +commutativeMonoid = record + { isCommutativeMonoid = record + { isMonoid = isMonoid isMonoidMonomorphism G.isMonoid + ; comm = ∙-comm + } + } + +Z[_] = commutativeMonoid diff --git a/src/Algebra/Construct/Centre/Semigroup.agda b/src/Algebra/Construct/Centre/Semigroup.agda new file mode 100644 index 0000000000..74ca73122f --- /dev/null +++ b/src/Algebra/Construct/Centre/Semigroup.agda @@ -0,0 +1,75 @@ +------------------------------------------------------------------------ +-- The Agda standard library +-- +-- Definition of the centre of an Semigroup +------------------------------------------------------------------------ + +{-# OPTIONS --safe --cubical-compatible #-} + +open import Algebra.Bundles + using (Semigroup; CommutativeSemigroup; RawMagma) + +module Algebra.Construct.Centre.Semigroup + {c ℓ} (semigroup : Semigroup c ℓ) + where + +open import Algebra.Core using (Op₂) +open import Algebra.Morphism.MagmaMonomorphism using (isSemigroup) +open import Algebra.Morphism.Structures +open import Function.Base using (id; _$_) + +private + module G = Semigroup semigroup + +open import Relation.Binary.Reasoning.Setoid G.setoid as ≈-Reasoning + + +------------------------------------------------------------------------ +-- Definition + +-- Re-export the underlying subtype + +open import Algebra.Construct.Centre.Center G._≈_ G._∙_ as Z public + using (Center; ι; ∙-comm) + +-- Now, by associativity, a sub-Magma is definable + +_∙_ : Op₂ Center +g ∙ h = record + { ι = ι g G.∙ ι h + ; central = λ k → begin + (ι g G.∙ ι h) G.∙ k ≈⟨ G.assoc _ _ _ ⟩ + ι g G.∙ (ι h G.∙ k) ≈⟨ G.∙-congˡ $ Center.central h k ⟩ + ι g G.∙ (k G.∙ ι h) ≈⟨ G.assoc _ _ _ ⟨ + ι g G.∙ k G.∙ ι h ≈⟨ G.∙-congʳ $ Center.central g k ⟩ + k G.∙ ι g G.∙ ι h ≈⟨ G.assoc _ _ _ ⟩ + k G.∙ (ι g G.∙ ι h) ∎ + } where open ≈-Reasoning + +domain : RawMagma _ _ +domain = record {_≈_ = Z._≈_; _∙_ = _∙_ } + +isMagmaHomomorphism : IsMagmaHomomorphism domain G.rawMagma ι +isMagmaHomomorphism = record + { isRelHomomorphism = Z.isRelHomomorphism + ; homo = λ _ _ → G.refl + } + +isMagmaMonomorphism : IsMagmaMonomorphism domain G.rawMagma ι +isMagmaMonomorphism = record + { isMagmaHomomorphism = isMagmaHomomorphism + ; injective = id + } + +-- And hence a CommutativeSemigroup + +commutativeSemigroup : CommutativeSemigroup _ _ +commutativeSemigroup = record + { isCommutativeSemigroup = record + { isSemigroup = isSemigroup isMagmaMonomorphism G.isSemigroup + ; comm = ∙-comm + } + } + +Z[_] = commutativeSemigroup + From c94d9b544d5980df0e62f5ece5681a8e61a3310b Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Wed, 19 Nov 2025 13:40:48 +0000 Subject: [PATCH 02/16] fix: typo --- src/Algebra/Construct/Centre/Group.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Algebra/Construct/Centre/Group.agda b/src/Algebra/Construct/Centre/Group.agda index 745d2434bd..876ad414f3 100644 --- a/src/Algebra/Construct/Centre/Group.agda +++ b/src/Algebra/Construct/Centre/Group.agda @@ -1,7 +1,7 @@ ------------------------------------------------------------------------ -- The Agda standard library -- --- Definition of the centre of an Algebra +-- Definition of the centre of a Group ------------------------------------------------------------------------ {-# OPTIONS --safe --cubical-compatible #-} From 00db5c22cd9c4989f10817675a53ef6e2a5dd78b Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Wed, 19 Nov 2025 18:05:39 +0000 Subject: [PATCH 03/16] add: centre of a `Ring` --- CHANGELOG.md | 4 +- src/Algebra/Construct/Centre/Ring.agda | 106 +++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 src/Algebra/Construct/Centre/Ring.agda diff --git a/CHANGELOG.md b/CHANGELOG.md index d30827c5b7..0ca1d2322f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,8 +80,8 @@ New modules ----------- * `Algebra.Construct.Centre.X` for the definition of the centre of an algebra, - where `X = {Semigroup|Monoid|Group}`, based on an underlying type defined in - `Algebra.Construct.Centre`. + where `X = {Semigroup|Monoid|Group|Ring}`, based on an underlying type defined + in `Algebra.Construct.Centre`. * `Algebra.Construct.Sub.Group` for the definition of subgroups. diff --git a/src/Algebra/Construct/Centre/Ring.agda b/src/Algebra/Construct/Centre/Ring.agda new file mode 100644 index 0000000000..c5b4da52ee --- /dev/null +++ b/src/Algebra/Construct/Centre/Ring.agda @@ -0,0 +1,106 @@ +------------------------------------------------------------------------ +-- The Agda standard library +-- +-- Definition of the centre of a Ring +------------------------------------------------------------------------ + +{-# OPTIONS --safe --cubical-compatible #-} + +open import Algebra.Bundles + using (Ring; CommutativeRing; Monoid; RawRing; RawMonoid) + +module Algebra.Construct.Centre.Ring {c ℓ} (ring : Ring c ℓ) where + +open import Algebra.Core using (Op₁; Op₂) +open import Algebra.Consequences.Setoid using (zero⇒central) +open import Algebra.Morphism.Structures +open import Algebra.Morphism.RingMonomorphism using (isRing) +open import Function.Base using (id; const; _$_) + + +private + module R = Ring ring + module R* = Monoid R.*-monoid + +open import Relation.Binary.Reasoning.Setoid R.setoid as ≈-Reasoning +open import Algebra.Properties.Ring ring using (-‿distribˡ-*; -‿distribʳ-*) + + +------------------------------------------------------------------------ +-- Definition + +-- Re-export the underlying sub-Monoid + +open import Algebra.Construct.Centre.Monoid R.*-monoid as Z public + using (Center; ι; ∙-comm) + +-- Now, can define a commutative sub-Ring + +_+_ : Op₂ Center +g + h = record + { ι = ι g R.+ ι h + ; central = λ r → begin + (ι g R.+ ι h) R.* r ≈⟨ R.distribʳ _ _ _ ⟩ + ι g R.* r R.+ ι h R.* r ≈⟨ R.+-cong (Center.central g r) (Center.central h r) ⟩ + r R.* ι g R.+ r R.* ι h ≈⟨ R.distribˡ _ _ _ ⟨ + r R.* (ι g R.+ ι h) ∎ + } + +-_ : Op₁ Center +- g = record + { ι = R.- ι g + ; central = λ r → begin R.- ι g R.* r ≈⟨ -‿distribˡ-* (ι g) r ⟨ + R.- (ι g R.* r) ≈⟨ R.-‿cong (Center.central g r) ⟩ + R.- (r R.* ι g) ≈⟨ -‿distribʳ-* r (ι g) ⟩ + r R.* R.- ι g ∎ + } + +0# : Center +0# = record + { ι = R.0# + ; central = zero⇒central R.setoid {_∙_ = R._*_} R.zero + } + +domain : RawRing _ _ +domain = record + { _≈_ = _≈_ + ; _+_ = _+_ + ; _*_ = _*_ + ; -_ = -_ + ; 0# = 0# + ; 1# = 1# + } where open RawMonoid Z.domain renaming (ε to 1#; _∙_ to _*_) + +isRingHomomorphism : IsRingHomomorphism domain R.rawRing ι +isRingHomomorphism = record + { isSemiringHomomorphism = record + { isNearSemiringHomomorphism = record + { +-isMonoidHomomorphism = record + { isMagmaHomomorphism = record + { isRelHomomorphism = record { cong = id } + ; homo = λ _ _ → R.refl + } + ; ε-homo = R.refl + } + ; *-homo = λ _ _ → R.refl + } + ; 1#-homo = R.refl + } + ; -‿homo = λ _ → R.refl + } + +isRingMonomorphism : IsRingMonomorphism domain R.rawRing ι +isRingMonomorphism = record + { isRingHomomorphism = isRingHomomorphism + ; injective = id + } + +commutativeRing : CommutativeRing _ _ +commutativeRing = record + { isCommutativeRing = record + { isRing = isRing isRingMonomorphism R.isRing + ; *-comm = ∙-comm + } + } + +Z[_] = commutativeRing From 210d9db224c83ead991bde6f9cb3eb14edca83ae Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 21 Nov 2025 05:40:59 +0000 Subject: [PATCH 04/16] fix: remove commented-out code --- src/Algebra/Construct/Centre/Group.agda | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Algebra/Construct/Centre/Group.agda b/src/Algebra/Construct/Centre/Group.agda index 876ad414f3..02be0f040e 100644 --- a/src/Algebra/Construct/Centre/Group.agda +++ b/src/Algebra/Construct/Centre/Group.agda @@ -72,14 +72,3 @@ abelianGroup = record } Z[_] = abelianGroup - -{- - normalSubgroup : NormalSubgroup _ _ - normalSubgroup = record - { subgroup = record { ι-isGroupMonomorphism = isGroupMonomorphism } - ; normal = record - { conjugate = const - ; normal = Center.central - } - } --} From d0ea58e34371fb9f14b57fa7abfa992c32442111 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 21 Nov 2025 06:26:02 +0000 Subject: [PATCH 05/16] refactor: use `Monoid` reasoning principles --- src/Algebra/Construct/Centre/Group.agda | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Algebra/Construct/Centre/Group.agda b/src/Algebra/Construct/Centre/Group.agda index 02be0f040e..55600c6c90 100644 --- a/src/Algebra/Construct/Centre/Group.agda +++ b/src/Algebra/Construct/Centre/Group.agda @@ -21,6 +21,8 @@ private module G = Group group open import Relation.Binary.Reasoning.Setoid G.setoid as ≈-Reasoning +open import Algebra.Properties.Monoid G.monoid + renaming (cancelˡ to inverse⇒cancelˡ; cancelʳ to inverse⇒cancelʳ) open import Algebra.Properties.Group group using (∙-cancelʳ) @@ -40,11 +42,8 @@ g ⁻¹ = record ; central = λ k → ∙-cancelʳ (ι g) _ _ $ begin (ι g G.⁻¹ G.∙ k) G.∙ (ι g) ≈⟨ G.assoc _ _ _ ⟩ ι g G.⁻¹ G.∙ (k G.∙ ι g) ≈⟨ G.∙-congˡ $ Center.central g k ⟨ - ι g G.⁻¹ G.∙ (ι g G.∙ k) ≈⟨ G.assoc _ _ _ ⟨ - (ι g G.⁻¹ G.∙ ι g) G.∙ k ≈⟨ G.∙-congʳ $ G.inverseˡ _ ⟩ - G.ε G.∙ k ≈⟨ Center.central Z.ε k ⟩ - k G.∙ G.ε ≈⟨ G.∙-congˡ $ G.inverseˡ _ ⟨ - k G.∙ (ι g G.⁻¹ G.∙ ι g) ≈⟨ G.assoc _ _ _ ⟨ + ι g G.⁻¹ G.∙ (ι g G.∙ k) ≈⟨ inverse⇒cancelˡ (G.inverseˡ _) _ ⟩ + k ≈⟨ inverse⇒cancelʳ (G.inverseˡ _) _ ⟨ (k G.∙ ι g G.⁻¹) G.∙ (ι g) ∎ } where open ≈-Reasoning From 172bdc8e4b7c396a2ab823af6d5c69c7ed1367a2 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 21 Nov 2025 08:29:08 +0000 Subject: [PATCH 06/16] =?UTF-8?q?refactor:=20use=20`=CE=B5-central`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Algebra/Construct/Centre/Monoid.agda | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Algebra/Construct/Centre/Monoid.agda b/src/Algebra/Construct/Centre/Monoid.agda index d08dae966e..aa09870096 100644 --- a/src/Algebra/Construct/Centre/Monoid.agda +++ b/src/Algebra/Construct/Centre/Monoid.agda @@ -13,11 +13,12 @@ module Algebra.Construct.Centre.Monoid {c ℓ} (monoid : Monoid c ℓ) where -open import Algebra.Consequences.Setoid using (identity⇒central) open import Algebra.Morphism.Structures open import Algebra.Morphism.MonoidMonomorphism using (isMonoid) open import Function.Base using (id) +open import Algebra.Properties.Monoid monoid using (ε-central) + private module G = Monoid monoid @@ -35,7 +36,7 @@ open import Algebra.Construct.Centre.Semigroup G.semigroup as Z public ε : Center ε = record { ι = G.ε - ; central = identity⇒central G.setoid {_∙_ = G._∙_} G.identity + ; central = ε-central } domain : RawMonoid _ _ From 703121cd07b95672cc9e95fa43e0cb8291fe4b32 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 21 Nov 2025 08:33:02 +0000 Subject: [PATCH 07/16] refactor: use `Relation.Binary.Morphism.Construct.On` --- src/Algebra/Construct/Centre/Center.agda | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/Algebra/Construct/Centre/Center.agda b/src/Algebra/Construct/Centre/Center.agda index cb8cfb3252..0d767f25a9 100644 --- a/src/Algebra/Construct/Centre/Center.agda +++ b/src/Algebra/Construct/Centre/Center.agda @@ -16,8 +16,7 @@ module Algebra.Construct.Centre.Center open import Algebra.Definitions _∼_ using (Central) open import Function.Base using (id; _on_) open import Level using (_⊔_) -open import Relation.Binary.Morphism.Structures - using (IsRelHomomorphism; IsRelMonomorphism) +import Relation.Binary.Morphism.Construct.On as On ------------------------------------------------------------------------ @@ -36,14 +35,5 @@ open Center public -- Center as subtype of Carrier -_≈_ : Rel Center _ -_≈_ = _∼_ on ι - -isRelHomomorphism : IsRelHomomorphism _≈_ _∼_ ι -isRelHomomorphism = record { cong = id } - -isRelMonomorphism : IsRelMonomorphism _≈_ _∼_ ι -isRelMonomorphism = record - { isHomomorphism = isRelHomomorphism - ; injective = id - } +open On _∼_ ι public + using (_≈_; isRelHomomorphism; isRelMonomorphism) From 07d534c97cbe80df6f4d34a7072475de9549a407 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Tue, 25 Nov 2025 04:05:55 +0000 Subject: [PATCH 08/16] refactor: use `Algebra.Properties.Semigroup`; tighten imports --- src/Algebra/Construct/Centre/Semigroup.agda | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Algebra/Construct/Centre/Semigroup.agda b/src/Algebra/Construct/Centre/Semigroup.agda index 74ca73122f..5080f28f95 100644 --- a/src/Algebra/Construct/Centre/Semigroup.agda +++ b/src/Algebra/Construct/Centre/Semigroup.agda @@ -16,11 +16,13 @@ module Algebra.Construct.Centre.Semigroup open import Algebra.Core using (Op₂) open import Algebra.Morphism.MagmaMonomorphism using (isSemigroup) open import Algebra.Morphism.Structures + using (IsMagmaHomomorphism; IsMagmaMonomorphism) open import Function.Base using (id; _$_) private module G = Semigroup semigroup +open import Algebra.Properties.Semigroup semigroup open import Relation.Binary.Reasoning.Setoid G.setoid as ≈-Reasoning @@ -38,10 +40,8 @@ _∙_ : Op₂ Center g ∙ h = record { ι = ι g G.∙ ι h ; central = λ k → begin - (ι g G.∙ ι h) G.∙ k ≈⟨ G.assoc _ _ _ ⟩ - ι g G.∙ (ι h G.∙ k) ≈⟨ G.∙-congˡ $ Center.central h k ⟩ - ι g G.∙ (k G.∙ ι h) ≈⟨ G.assoc _ _ _ ⟨ - ι g G.∙ k G.∙ ι h ≈⟨ G.∙-congʳ $ Center.central g k ⟩ + (ι g G.∙ ι h) G.∙ k ≈⟨ uv≈w⇒xu∙v≈xw (Center.central h k) (ι g) ⟩ + ι g G.∙ (k G.∙ ι h) ≈⟨ uv≈w⇒u∙vx≈wx (Center.central g k) (ι h) ⟩ k G.∙ ι g G.∙ ι h ≈⟨ G.assoc _ _ _ ⟩ k G.∙ (ι g G.∙ ι h) ∎ } where open ≈-Reasoning From 7d8ff4b27bffd5caee856fdb2ca6e2e56c77cbbb Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Tue, 25 Nov 2025 04:23:50 +0000 Subject: [PATCH 09/16] refactor: use more `Algebra.Properties.Semigroup`; tighten imports --- src/Algebra/Construct/Centre/Group.agda | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Algebra/Construct/Centre/Group.agda b/src/Algebra/Construct/Centre/Group.agda index 55600c6c90..1f223e1137 100644 --- a/src/Algebra/Construct/Centre/Group.agda +++ b/src/Algebra/Construct/Centre/Group.agda @@ -20,10 +20,11 @@ open import Function.Base using (id; const; _$_) private module G = Group group -open import Relation.Binary.Reasoning.Setoid G.setoid as ≈-Reasoning +open import Algebra.Properties.Group group using (∙-cancelʳ) open import Algebra.Properties.Monoid G.monoid + using (uv≈w⇒xu∙v≈xw) renaming (cancelˡ to inverse⇒cancelˡ; cancelʳ to inverse⇒cancelʳ) -open import Algebra.Properties.Group group using (∙-cancelʳ) +open import Relation.Binary.Reasoning.Setoid G.setoid as ≈-Reasoning ------------------------------------------------------------------------ @@ -40,8 +41,7 @@ _⁻¹ : Op₁ Center g ⁻¹ = record { ι = ι g G.⁻¹ ; central = λ k → ∙-cancelʳ (ι g) _ _ $ begin - (ι g G.⁻¹ G.∙ k) G.∙ (ι g) ≈⟨ G.assoc _ _ _ ⟩ - ι g G.⁻¹ G.∙ (k G.∙ ι g) ≈⟨ G.∙-congˡ $ Center.central g k ⟨ + (ι g G.⁻¹ G.∙ k) G.∙ (ι g) ≈⟨ uv≈w⇒xu∙v≈xw (G.sym (Center.central g k)) _ ⟩ ι g G.⁻¹ G.∙ (ι g G.∙ k) ≈⟨ inverse⇒cancelˡ (G.inverseˡ _) _ ⟩ k ≈⟨ inverse⇒cancelʳ (G.inverseˡ _) _ ⟨ (k G.∙ ι g G.⁻¹) G.∙ (ι g) ∎ From d68fddacca98e894a99bcdd3a12501b8fb04fb5e Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Tue, 25 Nov 2025 04:32:48 +0000 Subject: [PATCH 10/16] refactor: tighten imports --- src/Algebra/Construct/Centre/Group.agda | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Algebra/Construct/Centre/Group.agda b/src/Algebra/Construct/Centre/Group.agda index 1f223e1137..b847bf4e7c 100644 --- a/src/Algebra/Construct/Centre/Group.agda +++ b/src/Algebra/Construct/Centre/Group.agda @@ -13,6 +13,7 @@ module Algebra.Construct.Centre.Group {c ℓ} (group : Group c ℓ) where open import Algebra.Core using (Op₁) open import Algebra.Morphism.Structures + using (IsGroupHomomorphism; IsGroupMonomorphism) open import Algebra.Morphism.GroupMonomorphism using (isGroup) open import Function.Base using (id; const; _$_) From fe0f46670e0e779e6fc1be722b4c4f356cb5312d Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Tue, 25 Nov 2025 04:37:35 +0000 Subject: [PATCH 11/16] refactor: tidy `Ring` --- src/Algebra/Construct/Centre/Ring.agda | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Algebra/Construct/Centre/Ring.agda b/src/Algebra/Construct/Centre/Ring.agda index c5b4da52ee..f21b24d4fe 100644 --- a/src/Algebra/Construct/Centre/Ring.agda +++ b/src/Algebra/Construct/Centre/Ring.agda @@ -14,16 +14,16 @@ module Algebra.Construct.Centre.Ring {c ℓ} (ring : Ring c ℓ) where open import Algebra.Core using (Op₁; Op₂) open import Algebra.Consequences.Setoid using (zero⇒central) open import Algebra.Morphism.Structures + using (IsRingHomomorphism; IsRingMonomorphism) open import Algebra.Morphism.RingMonomorphism using (isRing) open import Function.Base using (id; const; _$_) private module R = Ring ring - module R* = Monoid R.*-monoid -open import Relation.Binary.Reasoning.Setoid R.setoid as ≈-Reasoning open import Algebra.Properties.Ring ring using (-‿distribˡ-*; -‿distribʳ-*) +open import Relation.Binary.Reasoning.Setoid R.setoid as ≈-Reasoning ------------------------------------------------------------------------ @@ -49,10 +49,11 @@ g + h = record -_ : Op₁ Center - g = record { ι = R.- ι g - ; central = λ r → begin R.- ι g R.* r ≈⟨ -‿distribˡ-* (ι g) r ⟨ - R.- (ι g R.* r) ≈⟨ R.-‿cong (Center.central g r) ⟩ - R.- (r R.* ι g) ≈⟨ -‿distribʳ-* r (ι g) ⟩ - r R.* R.- ι g ∎ + ; central = λ r → begin + R.- ι g R.* r ≈⟨ -‿distribˡ-* (ι g) r ⟨ + R.- (ι g R.* r) ≈⟨ R.-‿cong (Center.central g r) ⟩ + R.- (r R.* ι g) ≈⟨ -‿distribʳ-* r (ι g) ⟩ + r R.* R.- ι g ∎ } 0# : Center From 9bc471051751613f64e0149b8754e841d4b8c7b7 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Tue, 25 Nov 2025 04:42:06 +0000 Subject: [PATCH 12/16] fix: `CHANGELOG` --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09242f3ab9..b21a2f5ea6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -86,7 +86,7 @@ New modules * `Algebra.Construct.Centre.X` for the definition of the centre of an algebra, where `X = {Semigroup|Monoid|Group|Ring}`, based on an underlying type defined - in `Algebra.Construct.Centre`. + in `Algebra.Construct.Centre.Center`. * `Algebra.Construct.Sub.Group` for the definition of subgroups. From e58498ef431806205dcca05503a167d64dfe37a1 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Tue, 3 Mar 2026 09:47:55 +0000 Subject: [PATCH 13/16] rename: `Center` to `Centre` --- CHANGELOG.md | 2 +- .../Construct/Centre/{Center.agda => Centre.agda} | 10 +++++----- src/Algebra/Construct/Centre/Group.agda | 6 +++--- src/Algebra/Construct/Centre/Monoid.agda | 4 ++-- src/Algebra/Construct/Centre/Ring.agda | 12 ++++++------ src/Algebra/Construct/Centre/Semigroup.agda | 10 +++++----- 6 files changed, 22 insertions(+), 22 deletions(-) rename src/Algebra/Construct/Centre/{Center.agda => Centre.agda} (85%) diff --git a/CHANGELOG.md b/CHANGELOG.md index b21a2f5ea6..e310983a03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -86,7 +86,7 @@ New modules * `Algebra.Construct.Centre.X` for the definition of the centre of an algebra, where `X = {Semigroup|Monoid|Group|Ring}`, based on an underlying type defined - in `Algebra.Construct.Centre.Center`. + in `Algebra.Construct.Centre.Centre`. * `Algebra.Construct.Sub.Group` for the definition of subgroups. diff --git a/src/Algebra/Construct/Centre/Center.agda b/src/Algebra/Construct/Centre/Centre.agda similarity index 85% rename from src/Algebra/Construct/Centre/Center.agda rename to src/Algebra/Construct/Centre/Centre.agda index 0d767f25a9..bfbc3f0d93 100644 --- a/src/Algebra/Construct/Centre/Center.agda +++ b/src/Algebra/Construct/Centre/Centre.agda @@ -9,7 +9,7 @@ open import Algebra.Core using (Op₂) open import Relation.Binary.Core using (Rel) -module Algebra.Construct.Centre.Center +module Algebra.Construct.Centre.Centre {c ℓ} {Carrier : Set c} (_∼_ : Rel Carrier ℓ) (_∙_ : Op₂ Carrier) where @@ -22,18 +22,18 @@ import Relation.Binary.Morphism.Construct.On as On ------------------------------------------------------------------------ -- Definitions -record Center : Set (c ⊔ ℓ) where +record Centre : Set (c ⊔ ℓ) where field ι : Carrier central : Central _∙_ ι -open Center public +open Centre public using (ι) ∙-comm : ∀ g h → (ι g ∙ ι h) ∼ (ι h ∙ ι g) -∙-comm g h = Center.central g (ι h) +∙-comm g h = Centre.central g (ι h) --- Center as subtype of Carrier +-- Centre as subtype of Carrier open On _∼_ ι public using (_≈_; isRelHomomorphism; isRelMonomorphism) diff --git a/src/Algebra/Construct/Centre/Group.agda b/src/Algebra/Construct/Centre/Group.agda index b847bf4e7c..2ceb9bfa3b 100644 --- a/src/Algebra/Construct/Centre/Group.agda +++ b/src/Algebra/Construct/Centre/Group.agda @@ -34,15 +34,15 @@ open import Relation.Binary.Reasoning.Setoid G.setoid as ≈-Reasoning -- Re-export the underlying sub-Monoid open import Algebra.Construct.Centre.Monoid G.monoid as Z public - using (Center; ι; ∙-comm) + using (Centre; ι; ∙-comm) -- Now, can define a commutative sub-Group -_⁻¹ : Op₁ Center +_⁻¹ : Op₁ Centre g ⁻¹ = record { ι = ι g G.⁻¹ ; central = λ k → ∙-cancelʳ (ι g) _ _ $ begin - (ι g G.⁻¹ G.∙ k) G.∙ (ι g) ≈⟨ uv≈w⇒xu∙v≈xw (G.sym (Center.central g k)) _ ⟩ + (ι g G.⁻¹ G.∙ k) G.∙ (ι g) ≈⟨ uv≈w⇒xu∙v≈xw (G.sym (Centre.central g k)) _ ⟩ ι g G.⁻¹ G.∙ (ι g G.∙ k) ≈⟨ inverse⇒cancelˡ (G.inverseˡ _) _ ⟩ k ≈⟨ inverse⇒cancelʳ (G.inverseˡ _) _ ⟨ (k G.∙ ι g G.⁻¹) G.∙ (ι g) ∎ diff --git a/src/Algebra/Construct/Centre/Monoid.agda b/src/Algebra/Construct/Centre/Monoid.agda index aa09870096..21a97b6804 100644 --- a/src/Algebra/Construct/Centre/Monoid.agda +++ b/src/Algebra/Construct/Centre/Monoid.agda @@ -29,11 +29,11 @@ private -- Re-export the underlying sub-Semigroup open import Algebra.Construct.Centre.Semigroup G.semigroup as Z public - using (Center; ι; ∙-comm) + using (Centre; ι; ∙-comm) -- Now, can define a sub-Monoid -ε : Center +ε : Centre ε = record { ι = G.ε ; central = ε-central diff --git a/src/Algebra/Construct/Centre/Ring.agda b/src/Algebra/Construct/Centre/Ring.agda index f21b24d4fe..ca971494e9 100644 --- a/src/Algebra/Construct/Centre/Ring.agda +++ b/src/Algebra/Construct/Centre/Ring.agda @@ -32,31 +32,31 @@ open import Relation.Binary.Reasoning.Setoid R.setoid as ≈-Reasoning -- Re-export the underlying sub-Monoid open import Algebra.Construct.Centre.Monoid R.*-monoid as Z public - using (Center; ι; ∙-comm) + using (Centre; ι; ∙-comm) -- Now, can define a commutative sub-Ring -_+_ : Op₂ Center +_+_ : Op₂ Centre g + h = record { ι = ι g R.+ ι h ; central = λ r → begin (ι g R.+ ι h) R.* r ≈⟨ R.distribʳ _ _ _ ⟩ - ι g R.* r R.+ ι h R.* r ≈⟨ R.+-cong (Center.central g r) (Center.central h r) ⟩ + ι g R.* r R.+ ι h R.* r ≈⟨ R.+-cong (Centre.central g r) (Centre.central h r) ⟩ r R.* ι g R.+ r R.* ι h ≈⟨ R.distribˡ _ _ _ ⟨ r R.* (ι g R.+ ι h) ∎ } --_ : Op₁ Center +-_ : Op₁ Centre - g = record { ι = R.- ι g ; central = λ r → begin R.- ι g R.* r ≈⟨ -‿distribˡ-* (ι g) r ⟨ - R.- (ι g R.* r) ≈⟨ R.-‿cong (Center.central g r) ⟩ + R.- (ι g R.* r) ≈⟨ R.-‿cong (Centre.central g r) ⟩ R.- (r R.* ι g) ≈⟨ -‿distribʳ-* r (ι g) ⟩ r R.* R.- ι g ∎ } -0# : Center +0# : Centre 0# = record { ι = R.0# ; central = zero⇒central R.setoid {_∙_ = R._*_} R.zero diff --git a/src/Algebra/Construct/Centre/Semigroup.agda b/src/Algebra/Construct/Centre/Semigroup.agda index 5080f28f95..a359c93a40 100644 --- a/src/Algebra/Construct/Centre/Semigroup.agda +++ b/src/Algebra/Construct/Centre/Semigroup.agda @@ -31,17 +31,17 @@ open import Relation.Binary.Reasoning.Setoid G.setoid as ≈-Reasoning -- Re-export the underlying subtype -open import Algebra.Construct.Centre.Center G._≈_ G._∙_ as Z public - using (Center; ι; ∙-comm) +open import Algebra.Construct.Centre.Centre G._≈_ G._∙_ as Z public + using (Centre; ι; ∙-comm) -- Now, by associativity, a sub-Magma is definable -_∙_ : Op₂ Center +_∙_ : Op₂ Centre g ∙ h = record { ι = ι g G.∙ ι h ; central = λ k → begin - (ι g G.∙ ι h) G.∙ k ≈⟨ uv≈w⇒xu∙v≈xw (Center.central h k) (ι g) ⟩ - ι g G.∙ (k G.∙ ι h) ≈⟨ uv≈w⇒u∙vx≈wx (Center.central g k) (ι h) ⟩ + (ι g G.∙ ι h) G.∙ k ≈⟨ uv≈w⇒xu∙v≈xw (Centre.central h k) (ι g) ⟩ + ι g G.∙ (k G.∙ ι h) ≈⟨ uv≈w⇒u∙vx≈wx (Centre.central g k) (ι h) ⟩ k G.∙ ι g G.∙ ι h ≈⟨ G.assoc _ _ _ ⟩ k G.∙ (ι g G.∙ ι h) ∎ } where open ≈-Reasoning From 8f08ff1ec623bd66b6da25240c25268c50d51a45 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Tue, 3 Mar 2026 10:31:42 +0000 Subject: [PATCH 14/16] refactor: unpack all the nested substructures --- src/Algebra/Construct/Centre/Centre.agda | 1 - src/Algebra/Construct/Centre/Group.agda | 47 ++++++++------ src/Algebra/Construct/Centre/Monoid.agda | 32 ++++++---- src/Algebra/Construct/Centre/Ring.agda | 69 ++++++++++++--------- src/Algebra/Construct/Centre/Semigroup.agda | 45 ++++++++------ 5 files changed, 110 insertions(+), 84 deletions(-) diff --git a/src/Algebra/Construct/Centre/Centre.agda b/src/Algebra/Construct/Centre/Centre.agda index bfbc3f0d93..d6a2b40f0b 100644 --- a/src/Algebra/Construct/Centre/Centre.agda +++ b/src/Algebra/Construct/Centre/Centre.agda @@ -14,7 +14,6 @@ module Algebra.Construct.Centre.Centre where open import Algebra.Definitions _∼_ using (Central) -open import Function.Base using (id; _on_) open import Level using (_⊔_) import Relation.Binary.Morphism.Construct.On as On diff --git a/src/Algebra/Construct/Centre/Group.agda b/src/Algebra/Construct/Centre/Group.agda index 2ceb9bfa3b..9e3c2b7050 100644 --- a/src/Algebra/Construct/Centre/Group.agda +++ b/src/Algebra/Construct/Centre/Group.agda @@ -14,18 +14,21 @@ module Algebra.Construct.Centre.Group {c ℓ} (group : Group c ℓ) where open import Algebra.Core using (Op₁) open import Algebra.Morphism.Structures using (IsGroupHomomorphism; IsGroupMonomorphism) -open import Algebra.Morphism.GroupMonomorphism using (isGroup) -open import Function.Base using (id; const; _$_) +import Algebra.Morphism.GroupMonomorphism as GroupMonomorphism + using (isGroup) +open import Algebra.Structures + using (IsGroup; IsAbelianGroup) +open import Function.Base using (id; _$_) private - module G = Group group + module X = Group group open import Algebra.Properties.Group group using (∙-cancelʳ) -open import Algebra.Properties.Monoid G.monoid +open import Algebra.Properties.Monoid X.monoid using (uv≈w⇒xu∙v≈xw) renaming (cancelˡ to inverse⇒cancelˡ; cancelʳ to inverse⇒cancelʳ) -open import Relation.Binary.Reasoning.Setoid G.setoid as ≈-Reasoning +open import Relation.Binary.Reasoning.Setoid X.setoid as ≈-Reasoning ------------------------------------------------------------------------ @@ -33,42 +36,46 @@ open import Relation.Binary.Reasoning.Setoid G.setoid as ≈-Reasoning -- Re-export the underlying sub-Monoid -open import Algebra.Construct.Centre.Monoid G.monoid as Z public +open import Algebra.Construct.Centre.Monoid X.monoid as Z public using (Centre; ι; ∙-comm) -- Now, can define a commutative sub-Group _⁻¹ : Op₁ Centre g ⁻¹ = record - { ι = ι g G.⁻¹ + { ι = ι g X.⁻¹ ; central = λ k → ∙-cancelʳ (ι g) _ _ $ begin - (ι g G.⁻¹ G.∙ k) G.∙ (ι g) ≈⟨ uv≈w⇒xu∙v≈xw (G.sym (Centre.central g k)) _ ⟩ - ι g G.⁻¹ G.∙ (ι g G.∙ k) ≈⟨ inverse⇒cancelˡ (G.inverseˡ _) _ ⟩ - k ≈⟨ inverse⇒cancelʳ (G.inverseˡ _) _ ⟨ - (k G.∙ ι g G.⁻¹) G.∙ (ι g) ∎ + (ι g X.⁻¹ X.∙ k) X.∙ (ι g) ≈⟨ uv≈w⇒xu∙v≈xw (X.sym (Centre.central g k)) _ ⟩ + ι g X.⁻¹ X.∙ (ι g X.∙ k) ≈⟨ inverse⇒cancelˡ (X.inverseˡ _) _ ⟩ + k ≈⟨ inverse⇒cancelʳ (X.inverseˡ _) _ ⟨ + (k X.∙ ι g X.⁻¹) X.∙ (ι g) ∎ } where open ≈-Reasoning domain : RawGroup _ _ domain = record { RawMonoid Z.domain; _⁻¹ = _⁻¹ } -isGroupHomomorphism : IsGroupHomomorphism domain G.rawGroup ι +isGroupHomomorphism : IsGroupHomomorphism domain X.rawGroup ι isGroupHomomorphism = record { isMonoidHomomorphism = Z.isMonoidHomomorphism - ; ⁻¹-homo = λ _ → G.refl + ; ⁻¹-homo = λ _ → X.refl } -isGroupMonomorphism : IsGroupMonomorphism domain G.rawGroup ι +isGroupMonomorphism : IsGroupMonomorphism domain X.rawGroup ι isGroupMonomorphism = record { isGroupHomomorphism = isGroupHomomorphism ; injective = id } -abelianGroup : AbelianGroup _ _ -abelianGroup = record - { isAbelianGroup = record - { isGroup = isGroup isGroupMonomorphism G.isGroup - ; comm = ∙-comm - } +isGroup : IsGroup _ _ _ _ +isGroup = GroupMonomorphism.isGroup isGroupMonomorphism X.isGroup + +isAbelianGroup : IsAbelianGroup _ _ _ _ +isAbelianGroup = record + { isGroup = isGroup + ; comm = ∙-comm } +abelianGroup : AbelianGroup _ _ +abelianGroup = record { isAbelianGroup = isAbelianGroup } + Z[_] = abelianGroup diff --git a/src/Algebra/Construct/Centre/Monoid.agda b/src/Algebra/Construct/Centre/Monoid.agda index 21a97b6804..6a19830c54 100644 --- a/src/Algebra/Construct/Centre/Monoid.agda +++ b/src/Algebra/Construct/Centre/Monoid.agda @@ -14,13 +14,15 @@ module Algebra.Construct.Centre.Monoid where open import Algebra.Morphism.Structures -open import Algebra.Morphism.MonoidMonomorphism using (isMonoid) +import Algebra.Morphism.MonoidMonomorphism as MonoidMonomorphism + using (isMonoid) +open import Algebra.Structures using (IsMonoid; IsCommutativeMonoid) open import Function.Base using (id) open import Algebra.Properties.Monoid monoid using (ε-central) private - module G = Monoid monoid + module X = Monoid monoid ------------------------------------------------------------------------ @@ -28,27 +30,27 @@ private -- Re-export the underlying sub-Semigroup -open import Algebra.Construct.Centre.Semigroup G.semigroup as Z public +open import Algebra.Construct.Centre.Semigroup X.semigroup as Z public using (Centre; ι; ∙-comm) -- Now, can define a sub-Monoid ε : Centre ε = record - { ι = G.ε + { ι = X.ε ; central = ε-central } domain : RawMonoid _ _ domain = record { RawMagma Z.domain; ε = ε } -isMonoidHomomorphism : IsMonoidHomomorphism domain G.rawMonoid ι +isMonoidHomomorphism : IsMonoidHomomorphism domain X.rawMonoid ι isMonoidHomomorphism = record { isMagmaHomomorphism = Z.isMagmaHomomorphism - ; ε-homo = G.refl + ; ε-homo = X.refl } -isMonoidMonomorphism : IsMonoidMonomorphism domain G.rawMonoid ι +isMonoidMonomorphism : IsMonoidMonomorphism domain X.rawMonoid ι isMonoidMonomorphism = record { isMonoidHomomorphism = isMonoidHomomorphism ; injective = id @@ -56,12 +58,16 @@ isMonoidMonomorphism = record -- And hence a CommutativeMonoid -commutativeMonoid : CommutativeMonoid _ _ -commutativeMonoid = record - { isCommutativeMonoid = record - { isMonoid = isMonoid isMonoidMonomorphism G.isMonoid - ; comm = ∙-comm - } +isMonoid : IsMonoid _ _ _ +isMonoid = MonoidMonomorphism.isMonoid isMonoidMonomorphism X.isMonoid + +isCommutativeMonoid : IsCommutativeMonoid _ _ _ +isCommutativeMonoid = record + { isMonoid = isMonoid + ; comm = ∙-comm } +commutativeMonoid : CommutativeMonoid _ _ +commutativeMonoid = record { isCommutativeMonoid = isCommutativeMonoid } + Z[_] = commutativeMonoid diff --git a/src/Algebra/Construct/Centre/Ring.agda b/src/Algebra/Construct/Centre/Ring.agda index ca971494e9..b0c0bbb80b 100644 --- a/src/Algebra/Construct/Centre/Ring.agda +++ b/src/Algebra/Construct/Centre/Ring.agda @@ -14,16 +14,19 @@ module Algebra.Construct.Centre.Ring {c ℓ} (ring : Ring c ℓ) where open import Algebra.Core using (Op₁; Op₂) open import Algebra.Consequences.Setoid using (zero⇒central) open import Algebra.Morphism.Structures - using (IsRingHomomorphism; IsRingMonomorphism) -open import Algebra.Morphism.RingMonomorphism using (isRing) -open import Function.Base using (id; const; _$_) + using (IsSemiringHomomorphism; IsRingHomomorphism; IsRingMonomorphism) +import Algebra.Morphism.RingMonomorphism as RingMonomorphism + using (isRing) +open import Algebra.Structures + using (IsRing; IsCommutativeRing) +open import Function.Base using (id) private - module R = Ring ring + module X = Ring ring open import Algebra.Properties.Ring ring using (-‿distribˡ-*; -‿distribʳ-*) -open import Relation.Binary.Reasoning.Setoid R.setoid as ≈-Reasoning +open import Relation.Binary.Reasoning.Setoid X.setoid as ≈-Reasoning ------------------------------------------------------------------------ @@ -31,35 +34,35 @@ open import Relation.Binary.Reasoning.Setoid R.setoid as ≈-Reasoning -- Re-export the underlying sub-Monoid -open import Algebra.Construct.Centre.Monoid R.*-monoid as Z public +open import Algebra.Construct.Centre.Monoid X.*-monoid as Z public using (Centre; ι; ∙-comm) -- Now, can define a commutative sub-Ring _+_ : Op₂ Centre g + h = record - { ι = ι g R.+ ι h + { ι = ι g X.+ ι h ; central = λ r → begin - (ι g R.+ ι h) R.* r ≈⟨ R.distribʳ _ _ _ ⟩ - ι g R.* r R.+ ι h R.* r ≈⟨ R.+-cong (Centre.central g r) (Centre.central h r) ⟩ - r R.* ι g R.+ r R.* ι h ≈⟨ R.distribˡ _ _ _ ⟨ - r R.* (ι g R.+ ι h) ∎ + (ι g X.+ ι h) X.* r ≈⟨ X.distribʳ _ _ _ ⟩ + ι g X.* r X.+ ι h X.* r ≈⟨ X.+-cong (Centre.central g r) (Centre.central h r) ⟩ + r X.* ι g X.+ r X.* ι h ≈⟨ X.distribˡ _ _ _ ⟨ + r X.* (ι g X.+ ι h) ∎ } -_ : Op₁ Centre - g = record - { ι = R.- ι g + { ι = X.- ι g ; central = λ r → begin - R.- ι g R.* r ≈⟨ -‿distribˡ-* (ι g) r ⟨ - R.- (ι g R.* r) ≈⟨ R.-‿cong (Centre.central g r) ⟩ - R.- (r R.* ι g) ≈⟨ -‿distribʳ-* r (ι g) ⟩ - r R.* R.- ι g ∎ + X.- ι g X.* r ≈⟨ -‿distribˡ-* (ι g) r ⟨ + X.- (ι g X.* r) ≈⟨ X.-‿cong (Centre.central g r) ⟩ + X.- (r X.* ι g) ≈⟨ -‿distribʳ-* r (ι g) ⟩ + r X.* X.- ι g ∎ } 0# : Centre 0# = record - { ι = R.0# - ; central = zero⇒central R.setoid {_∙_ = R._*_} R.zero + { ι = X.0# + ; central = zero⇒central X.setoid {_∙_ = X._*_} X.zero } domain : RawRing _ _ @@ -72,36 +75,40 @@ domain = record ; 1# = 1# } where open RawMonoid Z.domain renaming (ε to 1#; _∙_ to _*_) -isRingHomomorphism : IsRingHomomorphism domain R.rawRing ι +isRingHomomorphism : IsRingHomomorphism domain X.rawRing ι isRingHomomorphism = record { isSemiringHomomorphism = record { isNearSemiringHomomorphism = record { +-isMonoidHomomorphism = record { isMagmaHomomorphism = record { isRelHomomorphism = record { cong = id } - ; homo = λ _ _ → R.refl + ; homo = λ _ _ → X.refl } - ; ε-homo = R.refl + ; ε-homo = X.refl } - ; *-homo = λ _ _ → R.refl + ; *-homo = λ _ _ → X.refl } - ; 1#-homo = R.refl + ; 1#-homo = X.refl } - ; -‿homo = λ _ → R.refl + ; -‿homo = λ _ → X.refl } -isRingMonomorphism : IsRingMonomorphism domain R.rawRing ι +isRingMonomorphism : IsRingMonomorphism domain X.rawRing ι isRingMonomorphism = record { isRingHomomorphism = isRingHomomorphism ; injective = id } -commutativeRing : CommutativeRing _ _ -commutativeRing = record - { isCommutativeRing = record - { isRing = isRing isRingMonomorphism R.isRing - ; *-comm = ∙-comm - } +isRing : IsRing _ _ _ _ _ _ +isRing = RingMonomorphism.isRing isRingMonomorphism X.isRing + +isCommutativeRing : IsCommutativeRing _ _ _ _ _ _ +isCommutativeRing = record + { isRing = isRing + ; *-comm = ∙-comm } +commutativeRing : CommutativeRing _ _ +commutativeRing = record { isCommutativeRing = isCommutativeRing } + Z[_] = commutativeRing diff --git a/src/Algebra/Construct/Centre/Semigroup.agda b/src/Algebra/Construct/Centre/Semigroup.agda index a359c93a40..30ac67e350 100644 --- a/src/Algebra/Construct/Centre/Semigroup.agda +++ b/src/Algebra/Construct/Centre/Semigroup.agda @@ -14,16 +14,19 @@ module Algebra.Construct.Centre.Semigroup where open import Algebra.Core using (Op₂) -open import Algebra.Morphism.MagmaMonomorphism using (isSemigroup) +import Algebra.Morphism.MagmaMonomorphism as MagmaMonomorphism + using (isSemigroup) open import Algebra.Morphism.Structures using (IsMagmaHomomorphism; IsMagmaMonomorphism) -open import Function.Base using (id; _$_) +open import Algebra.Structures + using (IsSemigroup; IsCommutativeSemigroup) +open import Function.Base using (id) private - module G = Semigroup semigroup + module X = Semigroup semigroup open import Algebra.Properties.Semigroup semigroup -open import Relation.Binary.Reasoning.Setoid G.setoid as ≈-Reasoning +open import Relation.Binary.Reasoning.Setoid X.setoid as ≈-Reasoning ------------------------------------------------------------------------ @@ -31,31 +34,31 @@ open import Relation.Binary.Reasoning.Setoid G.setoid as ≈-Reasoning -- Re-export the underlying subtype -open import Algebra.Construct.Centre.Centre G._≈_ G._∙_ as Z public +open import Algebra.Construct.Centre.Centre X._≈_ X._∙_ as Z public using (Centre; ι; ∙-comm) -- Now, by associativity, a sub-Magma is definable _∙_ : Op₂ Centre g ∙ h = record - { ι = ι g G.∙ ι h + { ι = ι g X.∙ ι h ; central = λ k → begin - (ι g G.∙ ι h) G.∙ k ≈⟨ uv≈w⇒xu∙v≈xw (Centre.central h k) (ι g) ⟩ - ι g G.∙ (k G.∙ ι h) ≈⟨ uv≈w⇒u∙vx≈wx (Centre.central g k) (ι h) ⟩ - k G.∙ ι g G.∙ ι h ≈⟨ G.assoc _ _ _ ⟩ - k G.∙ (ι g G.∙ ι h) ∎ + (ι g X.∙ ι h) X.∙ k ≈⟨ uv≈w⇒xu∙v≈xw (Centre.central h k) (ι g) ⟩ + ι g X.∙ (k X.∙ ι h) ≈⟨ uv≈w⇒u∙vx≈wx (Centre.central g k) (ι h) ⟩ + k X.∙ ι g X.∙ ι h ≈⟨ X.assoc _ _ _ ⟩ + k X.∙ (ι g X.∙ ι h) ∎ } where open ≈-Reasoning domain : RawMagma _ _ domain = record {_≈_ = Z._≈_; _∙_ = _∙_ } -isMagmaHomomorphism : IsMagmaHomomorphism domain G.rawMagma ι +isMagmaHomomorphism : IsMagmaHomomorphism domain X.rawMagma ι isMagmaHomomorphism = record { isRelHomomorphism = Z.isRelHomomorphism - ; homo = λ _ _ → G.refl + ; homo = λ _ _ → X.refl } -isMagmaMonomorphism : IsMagmaMonomorphism domain G.rawMagma ι +isMagmaMonomorphism : IsMagmaMonomorphism domain X.rawMagma ι isMagmaMonomorphism = record { isMagmaHomomorphism = isMagmaHomomorphism ; injective = id @@ -63,13 +66,17 @@ isMagmaMonomorphism = record -- And hence a CommutativeSemigroup -commutativeSemigroup : CommutativeSemigroup _ _ -commutativeSemigroup = record - { isCommutativeSemigroup = record - { isSemigroup = isSemigroup isMagmaMonomorphism G.isSemigroup - ; comm = ∙-comm - } +isSemigroup : IsSemigroup _ _ +isSemigroup = MagmaMonomorphism.isSemigroup isMagmaMonomorphism X.isSemigroup + +isCommutativeSemigroup : IsCommutativeSemigroup _ _ +isCommutativeSemigroup = record + { isSemigroup = isSemigroup + ; comm = ∙-comm } +commutativeSemigroup : CommutativeSemigroup _ _ +commutativeSemigroup = record { isCommutativeSemigroup = isCommutativeSemigroup } + Z[_] = commutativeSemigroup From a323a01aa90d2dca8cff2c20dad5ccf44c6805b5 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Wed, 4 Mar 2026 15:26:00 +0000 Subject: [PATCH 15/16] refactor: follow #2391 --- src/Algebra/Construct/Centre/Group.agda | 66 +++++------ src/Algebra/Construct/Centre/Monoid.agda | 53 ++++----- src/Algebra/Construct/Centre/Ring.agda | 118 ++++++++++---------- src/Algebra/Construct/Centre/Semigroup.agda | 65 ++++++----- 4 files changed, 152 insertions(+), 150 deletions(-) diff --git a/src/Algebra/Construct/Centre/Group.agda b/src/Algebra/Construct/Centre/Group.agda index 9e3c2b7050..5791cf5ff4 100644 --- a/src/Algebra/Construct/Centre/Group.agda +++ b/src/Algebra/Construct/Centre/Group.agda @@ -12,12 +12,8 @@ open import Algebra.Bundles module Algebra.Construct.Centre.Group {c ℓ} (group : Group c ℓ) where open import Algebra.Core using (Op₁) -open import Algebra.Morphism.Structures - using (IsGroupHomomorphism; IsGroupMonomorphism) -import Algebra.Morphism.GroupMonomorphism as GroupMonomorphism - using (isGroup) -open import Algebra.Structures - using (IsGroup; IsAbelianGroup) +open import Algebra.Morphism.Structures using (IsGroupMonomorphism) +open import Algebra.Morphism.GroupMonomorphism using (isGroup) open import Function.Base using (id; _$_) @@ -41,41 +37,47 @@ open import Algebra.Construct.Centre.Monoid X.monoid as Z public -- Now, can define a commutative sub-Group -_⁻¹ : Op₁ Centre -g ⁻¹ = record - { ι = ι g X.⁻¹ - ; central = λ k → ∙-cancelʳ (ι g) _ _ $ begin - (ι g X.⁻¹ X.∙ k) X.∙ (ι g) ≈⟨ uv≈w⇒xu∙v≈xw (X.sym (Centre.central g k)) _ ⟩ - ι g X.⁻¹ X.∙ (ι g X.∙ k) ≈⟨ inverse⇒cancelˡ (X.inverseˡ _) _ ⟩ - k ≈⟨ inverse⇒cancelʳ (X.inverseˡ _) _ ⟨ - (k X.∙ ι g X.⁻¹) X.∙ (ι g) ∎ - } where open ≈-Reasoning - domain : RawGroup _ _ domain = record { RawMonoid Z.domain; _⁻¹ = _⁻¹ } - -isGroupHomomorphism : IsGroupHomomorphism domain X.rawGroup ι -isGroupHomomorphism = record - { isMonoidHomomorphism = Z.isMonoidHomomorphism - ; ⁻¹-homo = λ _ → X.refl - } - + where + _⁻¹ : Op₁ Centre + g ⁻¹ = record + { ι = ι g X.⁻¹ + ; central = λ k → ∙-cancelʳ (ι g) _ _ $ begin + (ι g X.⁻¹ X.∙ k) X.∙ (ι g) ≈⟨ uv≈w⇒xu∙v≈xw (X.sym (Centre.central g k)) _ ⟩ + ι g X.⁻¹ X.∙ (ι g X.∙ k) ≈⟨ inverse⇒cancelˡ (X.inverseˡ _) _ ⟩ + k ≈⟨ inverse⇒cancelʳ (X.inverseˡ _) _ ⟨ + (k X.∙ ι g X.⁻¹) X.∙ (ι g) ∎ + } where open ≈-Reasoning + + isGroupMonomorphism : IsGroupMonomorphism domain X.rawGroup ι isGroupMonomorphism = record - { isGroupHomomorphism = isGroupHomomorphism + { isGroupHomomorphism = record + { isMonoidHomomorphism = Z.isMonoidHomomorphism + ; ⁻¹-homo = λ _ → X.refl + } ; injective = id } -isGroup : IsGroup _ _ _ _ -isGroup = GroupMonomorphism.isGroup isGroupMonomorphism X.isGroup +-- Public export of the sub-X-homomorphisms -isAbelianGroup : IsAbelianGroup _ _ _ _ -isAbelianGroup = record - { isGroup = isGroup - ; comm = ∙-comm - } +open IsGroupMonomorphism isGroupMonomorphism public + +-- And hence an AbelianGroup abelianGroup : AbelianGroup _ _ -abelianGroup = record { isAbelianGroup = isAbelianGroup } +abelianGroup = record + { isAbelianGroup = record + { isGroup = isGroup isGroupMonomorphism X.isGroup + ; comm = ∙-comm + } + } + +-- Public export of the sub-X-structures/bundles + +open AbelianGroup abelianGroup public + +-- Public export of the bundle Z[_] = abelianGroup diff --git a/src/Algebra/Construct/Centre/Monoid.agda b/src/Algebra/Construct/Centre/Monoid.agda index 6a19830c54..bfecc7cf1f 100644 --- a/src/Algebra/Construct/Centre/Monoid.agda +++ b/src/Algebra/Construct/Centre/Monoid.agda @@ -13,10 +13,8 @@ module Algebra.Construct.Centre.Monoid {c ℓ} (monoid : Monoid c ℓ) where -open import Algebra.Morphism.Structures -import Algebra.Morphism.MonoidMonomorphism as MonoidMonomorphism - using (isMonoid) -open import Algebra.Structures using (IsMonoid; IsCommutativeMonoid) +open import Algebra.Morphism.Structures using (IsMonoidMonomorphism) +open import Algebra.Morphism.MonoidMonomorphism using (isMonoid) open import Function.Base using (id) open import Algebra.Properties.Monoid monoid using (ε-central) @@ -35,39 +33,42 @@ open import Algebra.Construct.Centre.Semigroup X.semigroup as Z public -- Now, can define a sub-Monoid -ε : Centre -ε = record - { ι = X.ε - ; central = ε-central - } - domain : RawMonoid _ _ domain = record { RawMagma Z.domain; ε = ε } - -isMonoidHomomorphism : IsMonoidHomomorphism domain X.rawMonoid ι -isMonoidHomomorphism = record - { isMagmaHomomorphism = Z.isMagmaHomomorphism - ; ε-homo = X.refl - } + where + ε : Centre + ε = record + { ι = X.ε + ; central = ε-central + } isMonoidMonomorphism : IsMonoidMonomorphism domain X.rawMonoid ι isMonoidMonomorphism = record - { isMonoidHomomorphism = isMonoidHomomorphism + { isMonoidHomomorphism = record + { isMagmaHomomorphism = Z.isMagmaHomomorphism + ; ε-homo = X.refl + } ; injective = id } --- And hence a CommutativeMonoid +-- Public export of the sub-X-homomorphisms -isMonoid : IsMonoid _ _ _ -isMonoid = MonoidMonomorphism.isMonoid isMonoidMonomorphism X.isMonoid +open IsMonoidMonomorphism isMonoidMonomorphism public -isCommutativeMonoid : IsCommutativeMonoid _ _ _ -isCommutativeMonoid = record - { isMonoid = isMonoid - ; comm = ∙-comm - } +-- And hence a CommutativeMonoid commutativeMonoid : CommutativeMonoid _ _ -commutativeMonoid = record { isCommutativeMonoid = isCommutativeMonoid } +commutativeMonoid = record + { isCommutativeMonoid = record + { isMonoid = isMonoid isMonoidMonomorphism X.isMonoid + ; comm = ∙-comm + } + } + +-- Public export of the sub-X-structures/bundles + +open CommutativeMonoid commutativeMonoid public + +-- Public export of the bundle Z[_] = commutativeMonoid diff --git a/src/Algebra/Construct/Centre/Ring.agda b/src/Algebra/Construct/Centre/Ring.agda index b0c0bbb80b..f82b37b367 100644 --- a/src/Algebra/Construct/Centre/Ring.agda +++ b/src/Algebra/Construct/Centre/Ring.agda @@ -13,12 +13,8 @@ module Algebra.Construct.Centre.Ring {c ℓ} (ring : Ring c ℓ) where open import Algebra.Core using (Op₁; Op₂) open import Algebra.Consequences.Setoid using (zero⇒central) -open import Algebra.Morphism.Structures - using (IsSemiringHomomorphism; IsRingHomomorphism; IsRingMonomorphism) -import Algebra.Morphism.RingMonomorphism as RingMonomorphism - using (isRing) -open import Algebra.Structures - using (IsRing; IsCommutativeRing) +open import Algebra.Morphism.Structures using (IsRingMonomorphism) +open import Algebra.Morphism.RingMonomorphism using (isRing) open import Function.Base using (id) @@ -39,32 +35,6 @@ open import Algebra.Construct.Centre.Monoid X.*-monoid as Z public -- Now, can define a commutative sub-Ring -_+_ : Op₂ Centre -g + h = record - { ι = ι g X.+ ι h - ; central = λ r → begin - (ι g X.+ ι h) X.* r ≈⟨ X.distribʳ _ _ _ ⟩ - ι g X.* r X.+ ι h X.* r ≈⟨ X.+-cong (Centre.central g r) (Centre.central h r) ⟩ - r X.* ι g X.+ r X.* ι h ≈⟨ X.distribˡ _ _ _ ⟨ - r X.* (ι g X.+ ι h) ∎ - } - --_ : Op₁ Centre -- g = record - { ι = X.- ι g - ; central = λ r → begin - X.- ι g X.* r ≈⟨ -‿distribˡ-* (ι g) r ⟨ - X.- (ι g X.* r) ≈⟨ X.-‿cong (Centre.central g r) ⟩ - X.- (r X.* ι g) ≈⟨ -‿distribʳ-* r (ι g) ⟩ - r X.* X.- ι g ∎ - } - -0# : Centre -0# = record - { ι = X.0# - ; central = zero⇒central X.setoid {_∙_ = X._*_} X.zero - } - domain : RawRing _ _ domain = record { _≈_ = _≈_ @@ -73,42 +43,72 @@ domain = record ; -_ = -_ ; 0# = 0# ; 1# = 1# - } where open RawMonoid Z.domain renaming (ε to 1#; _∙_ to _*_) - -isRingHomomorphism : IsRingHomomorphism domain X.rawRing ι -isRingHomomorphism = record - { isSemiringHomomorphism = record - { isNearSemiringHomomorphism = record - { +-isMonoidHomomorphism = record - { isMagmaHomomorphism = record - { isRelHomomorphism = record { cong = id } - ; homo = λ _ _ → X.refl + } + where + open RawMonoid Z.domain renaming (ε to 1#; _∙_ to _*_) + _+_ : Op₂ Centre + g + h = record + { ι = ι g X.+ ι h + ; central = λ r → begin + (ι g X.+ ι h) X.* r ≈⟨ X.distribʳ _ _ _ ⟩ + ι g X.* r X.+ ι h X.* r ≈⟨ X.+-cong (Centre.central g r) (Centre.central h r) ⟩ + r X.* ι g X.+ r X.* ι h ≈⟨ X.distribˡ _ _ _ ⟨ + r X.* (ι g X.+ ι h) ∎ + } + -_ : Op₁ Centre + - g = record + { ι = X.- ι g + ; central = λ r → begin + X.- ι g X.* r ≈⟨ -‿distribˡ-* (ι g) r ⟨ + X.- (ι g X.* r) ≈⟨ X.-‿cong (Centre.central g r) ⟩ + X.- (r X.* ι g) ≈⟨ -‿distribʳ-* r (ι g) ⟩ + r X.* X.- ι g ∎ + } + 0# : Centre + 0# = record + { ι = X.0# + ; central = zero⇒central X.setoid {_∙_ = X._*_} X.zero + } + +isRingMonomorphism : IsRingMonomorphism domain X.rawRing ι +isRingMonomorphism = record + { isRingHomomorphism = record + { isSemiringHomomorphism = record + { isNearSemiringHomomorphism = record + { +-isMonoidHomomorphism = record + { isMagmaHomomorphism = record + { isRelHomomorphism = record { cong = id } + ; homo = λ _ _ → X.refl + } + ; ε-homo = X.refl } - ; ε-homo = X.refl + ; *-homo = λ _ _ → X.refl } - ; *-homo = λ _ _ → X.refl + ; 1#-homo = X.refl } - ; 1#-homo = X.refl + ; -‿homo = λ _ → X.refl } - ; -‿homo = λ _ → X.refl + ; injective = id } -isRingMonomorphism : IsRingMonomorphism domain X.rawRing ι -isRingMonomorphism = record - { isRingHomomorphism = isRingHomomorphism - ; injective = id - } +-- Public export of the sub-X-homomorphisms -isRing : IsRing _ _ _ _ _ _ -isRing = RingMonomorphism.isRing isRingMonomorphism X.isRing +open IsRingMonomorphism isRingMonomorphism public -isCommutativeRing : IsCommutativeRing _ _ _ _ _ _ -isCommutativeRing = record - { isRing = isRing - ; *-comm = ∙-comm - } +-- And hence a CommutativeRing commutativeRing : CommutativeRing _ _ -commutativeRing = record { isCommutativeRing = isCommutativeRing } +commutativeRing = record + { isCommutativeRing = record + { isRing = isRing isRingMonomorphism X.isRing + ; *-comm = ∙-comm + } + } + +-- Public export of the sub-X-structures/bundles + +open CommutativeRing commutativeRing public + +-- Public export of the bundle Z[_] = commutativeRing diff --git a/src/Algebra/Construct/Centre/Semigroup.agda b/src/Algebra/Construct/Centre/Semigroup.agda index 30ac67e350..d979e09be9 100644 --- a/src/Algebra/Construct/Centre/Semigroup.agda +++ b/src/Algebra/Construct/Centre/Semigroup.agda @@ -14,12 +14,8 @@ module Algebra.Construct.Centre.Semigroup where open import Algebra.Core using (Op₂) -import Algebra.Morphism.MagmaMonomorphism as MagmaMonomorphism - using (isSemigroup) -open import Algebra.Morphism.Structures - using (IsMagmaHomomorphism; IsMagmaMonomorphism) -open import Algebra.Structures - using (IsSemigroup; IsCommutativeSemigroup) +open import Algebra.Morphism.MagmaMonomorphism using (isSemigroup) +open import Algebra.Morphism.Structures using (IsMagmaMonomorphism) open import Function.Base using (id) private @@ -39,44 +35,47 @@ open import Algebra.Construct.Centre.Centre X._≈_ X._∙_ as Z public -- Now, by associativity, a sub-Magma is definable -_∙_ : Op₂ Centre -g ∙ h = record - { ι = ι g X.∙ ι h - ; central = λ k → begin - (ι g X.∙ ι h) X.∙ k ≈⟨ uv≈w⇒xu∙v≈xw (Centre.central h k) (ι g) ⟩ - ι g X.∙ (k X.∙ ι h) ≈⟨ uv≈w⇒u∙vx≈wx (Centre.central g k) (ι h) ⟩ - k X.∙ ι g X.∙ ι h ≈⟨ X.assoc _ _ _ ⟩ - k X.∙ (ι g X.∙ ι h) ∎ - } where open ≈-Reasoning - domain : RawMagma _ _ domain = record {_≈_ = Z._≈_; _∙_ = _∙_ } - -isMagmaHomomorphism : IsMagmaHomomorphism domain X.rawMagma ι -isMagmaHomomorphism = record - { isRelHomomorphism = Z.isRelHomomorphism - ; homo = λ _ _ → X.refl - } + where + _∙_ : Op₂ Centre + g ∙ h = record + { ι = ι g X.∙ ι h + ; central = λ k → begin + (ι g X.∙ ι h) X.∙ k ≈⟨ uv≈w⇒xu∙v≈xw (Centre.central h k) (ι g) ⟩ + ι g X.∙ (k X.∙ ι h) ≈⟨ uv≈w⇒u∙vx≈wx (Centre.central g k) (ι h) ⟩ + k X.∙ ι g X.∙ ι h ≈⟨ X.assoc _ _ _ ⟩ + k X.∙ (ι g X.∙ ι h) ∎ + } where open ≈-Reasoning isMagmaMonomorphism : IsMagmaMonomorphism domain X.rawMagma ι isMagmaMonomorphism = record - { isMagmaHomomorphism = isMagmaHomomorphism - ; injective = id + { isMagmaHomomorphism = record + { isRelHomomorphism = Z.isRelHomomorphism + ; homo = λ _ _ → X.refl + } + ; injective = id } --- And hence a CommutativeSemigroup +-- Public export of the sub-X-homomorphisms -isSemigroup : IsSemigroup _ _ -isSemigroup = MagmaMonomorphism.isSemigroup isMagmaMonomorphism X.isSemigroup +open IsMagmaMonomorphism isMagmaMonomorphism public -isCommutativeSemigroup : IsCommutativeSemigroup _ _ -isCommutativeSemigroup = record - { isSemigroup = isSemigroup - ; comm = ∙-comm - } +-- And hence a CommutativeSemigroup commutativeSemigroup : CommutativeSemigroup _ _ -commutativeSemigroup = record { isCommutativeSemigroup = isCommutativeSemigroup } +commutativeSemigroup = record + { isCommutativeSemigroup = record + { isSemigroup = isSemigroup isMagmaMonomorphism X.isSemigroup + ; comm = ∙-comm + } + } + +-- Public export of the sub-X-structures/bundles + +open CommutativeSemigroup commutativeSemigroup public + +-- Public export of the bundle Z[_] = commutativeSemigroup From 2f17d3eae2ef680843a179c08ecb5a3bd370574f Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Wed, 4 Mar 2026 15:27:31 +0000 Subject: [PATCH 16/16] fix: whitespace --- src/Algebra/Construct/Centre/Group.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Algebra/Construct/Centre/Group.agda b/src/Algebra/Construct/Centre/Group.agda index 5791cf5ff4..19905ea0c8 100644 --- a/src/Algebra/Construct/Centre/Group.agda +++ b/src/Algebra/Construct/Centre/Group.agda @@ -50,7 +50,7 @@ domain = record { RawMonoid Z.domain; _⁻¹ = _⁻¹ } (k X.∙ ι g X.⁻¹) X.∙ (ι g) ∎ } where open ≈-Reasoning - + isGroupMonomorphism : IsGroupMonomorphism domain X.rawGroup ι isGroupMonomorphism = record { isGroupHomomorphism = record