|
| 1 | +------------------------------------------------------------------------ |
| 2 | +-- The Agda standard library |
| 3 | +-- |
| 4 | +-- This module constructs the biproduct of two R-modules, and similar |
| 5 | +-- for weaker module-like structures. |
| 6 | +-- The intended universal property is that the biproduct is both a |
| 7 | +-- product and a coproduct in the category of R-modules. |
| 8 | +------------------------------------------------------------------------ |
| 9 | + |
| 10 | +{-# OPTIONS --without-K --safe #-} |
| 11 | + |
| 12 | +module Algebra.Module.Construct.DirectProduct where |
| 13 | + |
| 14 | +open import Algebra.Bundles |
| 15 | +open import Algebra.Construct.DirectProduct |
| 16 | +open import Algebra.Module.Bundles |
| 17 | +open import Data.Product |
| 18 | +open import Data.Product.Relation.Binary.Pointwise.NonDependent |
| 19 | +open import Level |
| 20 | + |
| 21 | +private |
| 22 | + variable |
| 23 | + r s ℓr ℓs m m′ ℓm ℓm′ : Level |
| 24 | + |
| 25 | +------------------------------------------------------------------------ |
| 26 | +-- Bundles |
| 27 | + |
| 28 | +leftSemimodule : {R : Semiring r ℓr} → |
| 29 | + LeftSemimodule R m ℓm → |
| 30 | + LeftSemimodule R m′ ℓm′ → |
| 31 | + LeftSemimodule R (m ⊔ m′) (ℓm ⊔ ℓm′) |
| 32 | +leftSemimodule M N = record |
| 33 | + { _*ₗ_ = λ r → map (r M.*ₗ_) (r N.*ₗ_) |
| 34 | + ; isLeftSemimodule = record |
| 35 | + { +ᴹ-isCommutativeMonoid = CommutativeMonoid.isCommutativeMonoid |
| 36 | + (commutativeMonoid M.+ᴹ-commutativeMonoid N.+ᴹ-commutativeMonoid) |
| 37 | + ; isPreleftSemimodule = record |
| 38 | + { *ₗ-cong = λ where rr (mm , nn) → M.*ₗ-cong rr mm , N.*ₗ-cong rr nn |
| 39 | + ; *ₗ-zeroˡ = λ where (m , n) → M.*ₗ-zeroˡ m , N.*ₗ-zeroˡ n |
| 40 | + ; *ₗ-distribʳ = λ where |
| 41 | + (m , n) x y → M.*ₗ-distribʳ m x y , N.*ₗ-distribʳ n x y |
| 42 | + ; *ₗ-identityˡ = λ where (m , n) → M.*ₗ-identityˡ m , N.*ₗ-identityˡ n |
| 43 | + ; *ₗ-assoc = λ where x y (m , n) → M.*ₗ-assoc x y m , N.*ₗ-assoc x y n |
| 44 | + ; *ₗ-zeroʳ = λ x → M.*ₗ-zeroʳ x , N.*ₗ-zeroʳ x |
| 45 | + ; *ₗ-distribˡ = λ where |
| 46 | + x (m , n) (m′ , n′) → M.*ₗ-distribˡ x m m′ , N.*ₗ-distribˡ x n n′ |
| 47 | + } |
| 48 | + } |
| 49 | + } where module M = LeftSemimodule M; module N = LeftSemimodule N |
| 50 | + |
| 51 | +rightSemimodule : {R : Semiring r ℓr} → |
| 52 | + RightSemimodule R m ℓm → |
| 53 | + RightSemimodule R m′ ℓm′ → |
| 54 | + RightSemimodule R (m ⊔ m′) (ℓm ⊔ ℓm′) |
| 55 | +rightSemimodule M N = record |
| 56 | + { _*ᵣ_ = λ mn r → map (M._*ᵣ r) (N._*ᵣ r) mn |
| 57 | + ; isRightSemimodule = record |
| 58 | + { +ᴹ-isCommutativeMonoid = CommutativeMonoid.isCommutativeMonoid |
| 59 | + (commutativeMonoid M.+ᴹ-commutativeMonoid N.+ᴹ-commutativeMonoid) |
| 60 | + ; isPrerightSemimodule = record |
| 61 | + { *ᵣ-cong = λ where (mm , nn) rr → M.*ᵣ-cong mm rr , N.*ᵣ-cong nn rr |
| 62 | + ; *ᵣ-zeroʳ = λ where (m , n) → M.*ᵣ-zeroʳ m , N.*ᵣ-zeroʳ n |
| 63 | + ; *ᵣ-distribˡ = λ where |
| 64 | + (m , n) x y → M.*ᵣ-distribˡ m x y , N.*ᵣ-distribˡ n x y |
| 65 | + ; *ᵣ-identityʳ = λ where (m , n) → M.*ᵣ-identityʳ m , N.*ᵣ-identityʳ n |
| 66 | + ; *ᵣ-assoc = λ where |
| 67 | + (m , n) x y → M.*ᵣ-assoc m x y , N.*ᵣ-assoc n x y |
| 68 | + ; *ᵣ-zeroˡ = λ x → M.*ᵣ-zeroˡ x , N.*ᵣ-zeroˡ x |
| 69 | + ; *ᵣ-distribʳ = λ where |
| 70 | + x (m , n) (m′ , n′) → M.*ᵣ-distribʳ x m m′ , N.*ᵣ-distribʳ x n n′ |
| 71 | + } |
| 72 | + } |
| 73 | + } where module M = RightSemimodule M; module N = RightSemimodule N |
| 74 | + |
| 75 | +bisemimodule : {R : Semiring r ℓr} {S : Semiring s ℓs} → |
| 76 | + Bisemimodule R S m ℓm → |
| 77 | + Bisemimodule R S m′ ℓm′ → |
| 78 | + Bisemimodule R S (m ⊔ m′) (ℓm ⊔ ℓm′) |
| 79 | +bisemimodule M N = record |
| 80 | + { isBisemimodule = record |
| 81 | + { +ᴹ-isCommutativeMonoid = CommutativeMonoid.isCommutativeMonoid |
| 82 | + (commutativeMonoid M.+ᴹ-commutativeMonoid N.+ᴹ-commutativeMonoid) |
| 83 | + ; isPreleftSemimodule = LeftSemimodule.isPreleftSemimodule |
| 84 | + (leftSemimodule M.leftSemimodule N.leftSemimodule) |
| 85 | + ; isPrerightSemimodule = RightSemimodule.isPrerightSemimodule |
| 86 | + (rightSemimodule M.rightSemimodule N.rightSemimodule) |
| 87 | + ; *ₗ-*ᵣ-assoc = λ where |
| 88 | + x (m , n) y → M.*ₗ-*ᵣ-assoc x m y , N.*ₗ-*ᵣ-assoc x n y |
| 89 | + } |
| 90 | + } where module M = Bisemimodule M; module N = Bisemimodule N |
| 91 | + |
| 92 | +semimodule : {R : CommutativeSemiring r ℓr} → |
| 93 | + Semimodule R m ℓm → |
| 94 | + Semimodule R m′ ℓm′ → |
| 95 | + Semimodule R (m ⊔ m′) (ℓm ⊔ ℓm′) |
| 96 | +semimodule M N = record |
| 97 | + { isSemimodule = record |
| 98 | + { isBisemimodule = Bisemimodule.isBisemimodule |
| 99 | + (bisemimodule M.bisemimodule N.bisemimodule) |
| 100 | + } |
| 101 | + } where module M = Semimodule M; module N = Semimodule N |
| 102 | + |
| 103 | +leftModule : {R : Ring r ℓr} → |
| 104 | + LeftModule R m ℓm → |
| 105 | + LeftModule R m′ ℓm′ → |
| 106 | + LeftModule R (m ⊔ m′) (ℓm ⊔ ℓm′) |
| 107 | +leftModule M N = record |
| 108 | + { -ᴹ_ = map M.-ᴹ_ N.-ᴹ_ |
| 109 | + ; isLeftModule = record |
| 110 | + { isLeftSemimodule = LeftSemimodule.isLeftSemimodule |
| 111 | + (leftSemimodule M.leftSemimodule N.leftSemimodule) |
| 112 | + ; -ᴹ‿cong = λ where (mm , nn) → M.-ᴹ‿cong mm , N.-ᴹ‿cong nn |
| 113 | + ; -ᴹ‿inverse = λ where |
| 114 | + .proj₁ (m , n) → M.-ᴹ‿inverseˡ m , N.-ᴹ‿inverseˡ n |
| 115 | + .proj₂ (m , n) → M.-ᴹ‿inverseʳ m , N.-ᴹ‿inverseʳ n |
| 116 | + } |
| 117 | + } where module M = LeftModule M; module N = LeftModule N |
| 118 | + |
| 119 | +rightModule : {R : Ring r ℓr} → |
| 120 | + RightModule R m ℓm → |
| 121 | + RightModule R m′ ℓm′ → |
| 122 | + RightModule R (m ⊔ m′) (ℓm ⊔ ℓm′) |
| 123 | +rightModule M N = record |
| 124 | + { -ᴹ_ = map M.-ᴹ_ N.-ᴹ_ |
| 125 | + ; isRightModule = record |
| 126 | + { isRightSemimodule = RightSemimodule.isRightSemimodule |
| 127 | + (rightSemimodule M.rightSemimodule N.rightSemimodule) |
| 128 | + ; -ᴹ‿cong = λ where (mm , nn) → M.-ᴹ‿cong mm , N.-ᴹ‿cong nn |
| 129 | + ; -ᴹ‿inverse = λ where |
| 130 | + .proj₁ (m , n) → M.-ᴹ‿inverseˡ m , N.-ᴹ‿inverseˡ n |
| 131 | + .proj₂ (m , n) → M.-ᴹ‿inverseʳ m , N.-ᴹ‿inverseʳ n |
| 132 | + } |
| 133 | + } where module M = RightModule M; module N = RightModule N |
| 134 | + |
| 135 | +bimodule : {R : Ring r ℓr} {S : Ring s ℓs} → |
| 136 | + Bimodule R S m ℓm → |
| 137 | + Bimodule R S m′ ℓm′ → |
| 138 | + Bimodule R S (m ⊔ m′) (ℓm ⊔ ℓm′) |
| 139 | +bimodule M N = record |
| 140 | + { -ᴹ_ = map M.-ᴹ_ N.-ᴹ_ |
| 141 | + ; isBimodule = record |
| 142 | + { isBisemimodule = Bisemimodule.isBisemimodule |
| 143 | + (bisemimodule M.bisemimodule N.bisemimodule) |
| 144 | + ; -ᴹ‿cong = λ where (mm , nn) → M.-ᴹ‿cong mm , N.-ᴹ‿cong nn |
| 145 | + ; -ᴹ‿inverse = λ where |
| 146 | + .proj₁ (m , n) → M.-ᴹ‿inverseˡ m , N.-ᴹ‿inverseˡ n |
| 147 | + .proj₂ (m , n) → M.-ᴹ‿inverseʳ m , N.-ᴹ‿inverseʳ n |
| 148 | + } |
| 149 | + } where module M = Bimodule M; module N = Bimodule N |
| 150 | + |
| 151 | +⟨module⟩ : {R : CommutativeRing r ℓr} → |
| 152 | + Module R m ℓm → |
| 153 | + Module R m′ ℓm′ → |
| 154 | + Module R (m ⊔ m′) (ℓm ⊔ ℓm′) |
| 155 | +⟨module⟩ M N = record |
| 156 | + { isModule = record |
| 157 | + { isBimodule = Bimodule.isBimodule (bimodule M.bimodule N.bimodule) |
| 158 | + } |
| 159 | + } where module M = Module M; module N = Module N |
0 commit comments