Skip to content

Commit c2cff82

Browse files
committed
[ new ] bimodules, and modules in terms of bimodules
1 parent bc382f2 commit c2cff82

File tree

2 files changed

+400
-53
lines changed

2 files changed

+400
-53
lines changed

src/Algebra/Module.agda renamed to src/Algebra/Module/Bundles.agda

Lines changed: 101 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
{-# OPTIONS --without-K --safe #-}
99

10-
module Algebra.Module where
10+
module Algebra.Module.Bundles where
1111

12-
open import Algebra
13-
open import Algebra.Structures.Module
12+
open import Algebra.Bundles
13+
open import Algebra.Module.Structures
1414
open import Algebra.FunctionProperties.Core
1515
import Algebra.FunctionProperties.LeftAction as LFP
1616
import Algebra.FunctionProperties.RightAction as RFP
17-
open import Function
17+
open import Function.Base
1818
open import Level
1919
open import Relation.Binary
2020

@@ -152,6 +152,80 @@ record RightModule {r ℓr} (ring : Ring r ℓr) m ℓm
152152
using ()
153153
renaming (group to +ᴹ-group)
154154

155+
------------------------------------------------------------------------
156+
-- Bimodules
157+
------------------------------------------------------------------------
158+
159+
record Bisemimodule {r s ℓr ℓs} (R-semiring : Semiring r ℓr)
160+
(S-semiring : Semiring s ℓs) m ℓm
161+
: Set (r ⊔ s ⊔ ℓr ⊔ ℓs ⊔ suc (m ⊔ ℓm)) where
162+
private
163+
module R = Semiring R-semiring
164+
module S = Semiring S-semiring
165+
166+
infixr 7 _*ₗ_
167+
infixl 6 _+ᴹ_
168+
infix 4 _≈ᴹ_
169+
170+
field
171+
Carrierᴹ : Set m
172+
_≈ᴹ_ : Rel Carrierᴹ ℓm
173+
_+ᴹ_ : Op₂ Carrierᴹ
174+
_*ₗ_ : Opₗ R.Carrier Carrierᴹ
175+
_*ᵣ_ : Opᵣ S.Carrier Carrierᴹ
176+
0ᴹ : Carrierᴹ
177+
isBisemimodule : IsBisemimodule _≈ᴹ_ R-semiring S-semiring _+ᴹ_ _*ₗ_ _*ᵣ_ 0ᴹ
178+
179+
open IsBisemimodule isBisemimodule public
180+
181+
leftSemimodule : LeftSemimodule R-semiring m ℓm
182+
leftSemimodule = record { isLeftSemimodule = isLeftSemimodule }
183+
184+
rightSemimodule : RightSemimodule S-semiring m ℓm
185+
rightSemimodule = record { isRightSemimodule = isRightSemimodule }
186+
187+
open LeftSemimodule leftSemimodule public
188+
using ( +ᴹ-commutativeMonoid; +ᴹ-monoid; +ᴹ-semigroup; +ᴹ-magma; +ᴹ-rawMagma
189+
; +ᴹ-rawMonoid)
190+
191+
record Bimodule {r s ℓr ℓs} (R-ring : Ring r ℓr) (S-ring : Ring s ℓs) m ℓm
192+
: Set (r ⊔ s ⊔ ℓr ⊔ ℓs ⊔ suc (m ⊔ ℓm)) where
193+
private
194+
module R = Ring R-ring
195+
module S = Ring S-ring
196+
197+
infixr 7 _*ₗ_
198+
infixl 6 _+ᴹ_
199+
infix 4 _≈ᴹ_
200+
201+
field
202+
Carrierᴹ : Set m
203+
_≈ᴹ_ : Rel Carrierᴹ ℓm
204+
_+ᴹ_ : Op₂ Carrierᴹ
205+
_*ₗ_ : Opₗ R.Carrier Carrierᴹ
206+
_*ᵣ_ : Opᵣ S.Carrier Carrierᴹ
207+
0ᴹ : Carrierᴹ
208+
-ᴹ_ : Op₁ Carrierᴹ
209+
isBimodule : IsBimodule _≈ᴹ_ R-ring S-ring _+ᴹ_ _*ₗ_ _*ᵣ_ 0ᴹ -ᴹ_
210+
211+
open IsBimodule isBimodule public
212+
213+
leftModule : LeftModule R-ring m ℓm
214+
leftModule = record { isLeftModule = isLeftModule }
215+
216+
rightModule : RightModule S-ring m ℓm
217+
rightModule = record { isRightModule = isRightModule }
218+
219+
open LeftModule leftModule public
220+
using ( +ᴹ-abelianGroup; +ᴹ-commutativeMonoid; +ᴹ-group; +ᴹ-monoid
221+
; +ᴹ-semigroup; +ᴹ-magma; +ᴹ-rawMagma; +ᴹ-rawMonoid)
222+
223+
bisemimodule : Bisemimodule R.semiring S.semiring m ℓm
224+
bisemimodule = record { isBisemimodule = isBisemimodule }
225+
226+
open Bisemimodule bisemimodule public
227+
using (leftSemimodule; rightSemimodule)
228+
155229
------------------------------------------------------------------------
156230
-- Modules over commutative structures
157231
------------------------------------------------------------------------
@@ -170,24 +244,23 @@ record Semimodule {r ℓr} (commutativeSemiring : CommutativeSemiring r ℓr) m
170244
_≈ᴹ_ : Rel Carrierᴹ ℓm
171245
_+ᴹ_ : Op₂ Carrierᴹ
172246
_*ₗ_ : Opₗ Carrier Carrierᴹ
247+
_*ᵣ_ : Opᵣ Carrier Carrierᴹ
173248
0ᴹ : Carrierᴹ
174-
isSemimodule : IsSemimodule _≈ᴹ_ commutativeSemiring _+ᴹ_ _*ₗ_ 0ᴹ
249+
isSemimodule : IsSemimodule _≈ᴹ_ commutativeSemiring _+ᴹ_ _*ₗ_ _*ᵣ_ 0ᴹ
175250

176251
open IsSemimodule isSemimodule public
177252

178253
private
179254
module L = LFP Carrier _≈ᴹ_
180255
module R = RFP Carrier _≈ᴹ_
181256

182-
leftSemimodule : LeftSemimodule semiring m ℓm
183-
leftSemimodule = record { isLeftSemimodule = isLeftSemimodule }
184-
185-
open LeftSemimodule leftSemimodule public
186-
using ( +ᴹ-commutativeMonoid; +ᴹ-monoid; +ᴹ-semigroup; +ᴹ-magma
187-
; +ᴹ-rawMonoid; +ᴹ-rawMagma)
257+
bisemimodule : Bisemimodule semiring semiring m ℓm
258+
bisemimodule = record { isBisemimodule = isBisemimodule }
188259

189-
_*ᵣ_ : Opᵣ Carrier Carrierᴹ
190-
_*ᵣ_ = flip _*ₗ_
260+
open Bisemimodule bisemimodule public
261+
using ( leftSemimodule; rightSemimodule
262+
; +ᴹ-commutativeMonoid; +ᴹ-monoid; +ᴹ-semigroup; +ᴹ-magma; +ᴹ-rawMagma
263+
; +ᴹ-rawMonoid)
191264

192265
*ₗ-comm : L.Commutative _*ₗ_
193266
*ₗ-comm x y m =
@@ -196,26 +269,10 @@ record Semimodule {r ℓr} (commutativeSemiring : CommutativeSemiring r ℓr) m
196269
(*ₗ-assoc y x m))
197270

198271
*ᵣ-comm : R.Commutative _*ᵣ_
199-
*ᵣ-comm m x y = *ₗ-comm y x m
200-
201-
isRightSemimodule : IsRightSemimodule _≈ᴹ_ semiring _+ᴹ_ _*ᵣ_ 0ᴹ
202-
isRightSemimodule = record
203-
{ +ᴹ-isCommutativeMonoid = +ᴹ-isCommutativeMonoid
204-
; *ᵣ-cong = flip *ₗ-cong
205-
; *ᵣ-zeroʳ = *ₗ-zeroˡ
206-
; *ᵣ-distribˡ = λ m x y *ₗ-distribʳ m x y
207-
; *ᵣ-identityʳ = λ m *ₗ-identityˡ m
208-
; *ᵣ-assoc = λ m x y M-trans (*ₗ-comm y x m) (M-sym (*ₗ-assoc x y m))
209-
; *ᵣ-zeroˡ = *ₗ-zeroʳ
210-
; *ᵣ-distribʳ = λ x m n *ₗ-distribˡ x m n
211-
}
212-
213-
rightSemimodule : RightSemimodule semiring m ℓm
214-
rightSemimodule = record { isRightSemimodule = isRightSemimodule }
215-
216-
open RightSemimodule rightSemimodule public
217-
using ( *ᵣ-cong; *ᵣ-zeroʳ; *ᵣ-distribˡ; *ᵣ-identityʳ; *ᵣ-assoc; *ᵣ-zeroˡ
218-
; *ᵣ-distribʳ)
272+
*ᵣ-comm m x y =
273+
M-trans (*ᵣ-assoc m x y)
274+
(M-trans (*ᵣ-cong M-refl (*-comm _ _))
275+
(M-sym (*ᵣ-assoc m y x)))
219276

220277
record Module {r ℓr} (commutativeRing : CommutativeRing r ℓr) m ℓm
221278
: Set (r ⊔ ℓr ⊔ suc (m ⊔ ℓm)) where
@@ -231,43 +288,34 @@ record Module {r ℓr} (commutativeRing : CommutativeRing r ℓr) m ℓm
231288
_≈ᴹ_ : Rel Carrierᴹ ℓm
232289
_+ᴹ_ : Op₂ Carrierᴹ
233290
_*ₗ_ : Opₗ Carrier Carrierᴹ
291+
_*ᵣ_ : Opᵣ Carrier Carrierᴹ
234292
0ᴹ : Carrierᴹ
235293
-ᴹ_ : Op₁ Carrierᴹ
236-
isModule : IsModule _≈ᴹ_ commutativeRing _+ᴹ_ _*ₗ_ 0ᴹ -ᴹ_
294+
isModule : IsModule _≈ᴹ_ commutativeRing _+ᴹ_ _*ₗ_ _*ᵣ_ 0ᴹ -ᴹ_
237295

238296
open IsModule isModule public
239297

298+
{- TODO: #898
240299
semimodule : Semimodule commutativeSemiring m ℓm
241300
semimodule = record { isSemimodule = isSemimodule }
242301
243302
open Semimodule semimodule public
244303
using ( leftSemimodule; isLeftSemimodule; rightSemimodule
245304
; isRightSemimodule; _*ᵣ_; *ₗ-comm; *ᵣ-comm; *ᵣ-cong
246305
; *ᵣ-zeroʳ; *ᵣ-distribˡ; *ᵣ-identityʳ; *ᵣ-assoc; *ᵣ-zeroˡ
247-
; *ᵣ-distribʳ; +ᴹ-commutativeMonoid; +ᴹ-monoid; +ᴹ-semigroup
248-
; +ᴹ-magma ; +ᴹ-rawMonoid; +ᴹ-rawMagma)
306+
; *ᵣ-distribʳ)
307+
-}
249308

250309
leftModule : LeftModule ring m ℓm
251310
leftModule = record { isLeftModule = isLeftModule }
252311

253312
open LeftModule leftModule public
254-
using (+ᴹ-abelianGroup; +ᴹ-group)
255-
256-
isRightModule : IsRightModule _≈ᴹ_ ring _+ᴹ_ _*ᵣ_ 0ᴹ -ᴹ_
257-
isRightModule = record
258-
{ isRightSemimodule = record
259-
{ +ᴹ-isCommutativeMonoid = +ᴹ-isCommutativeMonoid
260-
; *ᵣ-cong = *ᵣ-cong
261-
; *ᵣ-zeroʳ = *ᵣ-zeroʳ
262-
; *ᵣ-distribˡ = *ᵣ-distribˡ
263-
; *ᵣ-identityʳ = *ᵣ-identityʳ
264-
; *ᵣ-assoc = *ᵣ-assoc
265-
; *ᵣ-zeroˡ = *ᵣ-zeroˡ
266-
; *ᵣ-distribʳ = *ᵣ-distribʳ
267-
}
268-
; -ᴹ‿cong = -ᴹ‿cong
269-
; -ᴹ‿inverse = -ᴹ‿inverse
270-
}
313+
using ( leftSemimodule
314+
; +ᴹ-abelianGroup; +ᴹ-group; +ᴹ-commutativeMonoid; +ᴹ-monoid
315+
; +ᴹ-semigroup; +ᴹ-magma ; +ᴹ-rawMonoid; +ᴹ-rawMagma)
271316

272317
rightModule : RightModule ring m ℓm
273318
rightModule = record { isRightModule = isRightModule }
319+
320+
open RightModule rightModule public
321+
using (rightSemimodule)

0 commit comments

Comments
 (0)