Debian Codegraph @

src/Algebra/Module/Construct/TensorUnit.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- This module constructs the unit of the monoidal structure on
5 -- R-modules, and similar for weaker module-like structures.
6 -- The intended universal property is that the maps out of the tensor
7 -- unit into M are isomorphic to the elements of M.
8 ------------------------------------------------------------------------
9
10 {-# OPTIONS --cubical-compatible --safe #-}
11
12 module Algebra.Module.Construct.TensorUnit where
13
14 open import Algebra.Bundles
15 using (RawSemiring; RawRing; Semiring; Ring; CommutativeSemiring
16 ; CommutativeRing)
17 open import Algebra.Module.Bundles
18 using (RawSemimodule; RawLeftSemimodule; RawRightSemimodule; RawBisemimodule
19 ; RawLeftModule; RawRightModule; RawBimodule; RawModule; LeftSemimodule
20 ; RightSemimodule; Bisemimodule; Semimodule; LeftModule; RightModule; Bimodule
21 ; Module)
22 open import Level using (Level; _⊔_)
23
24 private
25 variable
26 c ℓ : Level
27
28 ------------------------------------------------------------------------
29 -- Raw bundles
30
31 rawLeftSemimodule : {R : RawSemiring c ℓ} → RawLeftSemimodule _ c ℓ
32 rawLeftSemimodule {R = R} = record
33 { _≈ᴹ_ = _≈_
34 ; _+ᴹ_ = _+_
35 ; _*ₗ_ = _*_
36 ; 0ᴹ = 0#
37 } where open RawSemiring R
38
39 rawLeftModule : {R : RawRing c ℓ} → RawLeftModule _ c ℓ
40 rawLeftModule {R = R} = record
41 { RawLeftSemimodule (rawLeftSemimodule {R = rawSemiring})
42 ; -ᴹ_ = -_
43 } where open RawRing R
44
45 rawRightSemimodule : {R : RawSemiring c ℓ} → RawRightSemimodule _ c ℓ
46 rawRightSemimodule {R = R} = record
47 { _≈ᴹ_ = _≈_
48 ; _+ᴹ_ = _+_
49 ; _*ᵣ_ = _*_
50 ; 0ᴹ = 0#
51 } where open RawSemiring R
52
53 rawRightModule : {R : RawRing c ℓ} → RawRightModule _ c ℓ
54 rawRightModule {R = R} = record
55 { RawRightSemimodule (rawRightSemimodule {R = rawSemiring})
56 ; -ᴹ_ = -_
57 } where open RawRing R
58
59 rawBisemimodule : {R : RawSemiring c ℓ} → RawBisemimodule _ _ c ℓ
60 rawBisemimodule {R = R} = record
61 { _≈ᴹ_ = _≈_
62 ; _+ᴹ_ = _+_
63 ; _*ₗ_ = _*_
64 ; _*ᵣ_ = _*_
65 ; 0ᴹ = 0#
66 } where open RawSemiring R
67
68 rawBimodule : {R : RawRing c ℓ} → RawBimodule _ _ c ℓ
69 rawBimodule {R = R} = record
70 { RawBisemimodule (rawBisemimodule {R = rawSemiring})
71 ; -ᴹ_ = -_
72 } where open RawRing R
73
74
75 rawSemimodule : {R : RawSemiring c ℓ} → RawSemimodule _ c ℓ
76 rawSemimodule {R = R} = rawBisemimodule {R = R}
77
78 rawModule : {R : RawRing c ℓ} → RawModule _ c ℓ
79 rawModule {R = R} = rawBimodule {R = R}
80
81 ------------------------------------------------------------------------
82 -- Bundles
83
84 leftSemimodule : {R : Semiring c ℓ} → LeftSemimodule R c ℓ
85 leftSemimodule {R = semiring} = record
86 { Carrierᴹ = Carrier
87 ; _≈ᴹ_ = _≈_
88 ; _+ᴹ_ = _+_
89 ; _*ₗ_ = _*_
90 ; 0ᴹ = 0#
91 ; isLeftSemimodule = record
92 { +ᴹ-isCommutativeMonoid = +-isCommutativeMonoid
93 ; isPreleftSemimodule = record
94 { *ₗ-cong = *-cong
95 ; *ₗ-zeroˡ = zeroˡ
96 ; *ₗ-distribʳ = distribʳ
97 ; *ₗ-identityˡ = *-identityˡ
98 ; *ₗ-assoc = *-assoc
99 ; *ₗ-zeroʳ = zeroʳ
100 ; *ₗ-distribˡ = distribˡ
101 }
102 }
103 } where open Semiring semiring
104
105 rightSemimodule : {R : Semiring c ℓ} → RightSemimodule R c ℓ
106 rightSemimodule {R = semiring} = record
107 { Carrierᴹ = Carrier
108 ; _≈ᴹ_ = _≈_
109 ; _+ᴹ_ = _+_
110 ; _*ᵣ_ = _*_
111 ; 0ᴹ = 0#
112 ; isRightSemimodule = record
113 { +ᴹ-isCommutativeMonoid = +-isCommutativeMonoid
114 ; isPrerightSemimodule = record
115 { *ᵣ-cong = *-cong
116 ; *ᵣ-zeroʳ = zeroʳ
117 ; *ᵣ-distribˡ = distribˡ
118 ; *ᵣ-identityʳ = *-identityʳ
119 ; *ᵣ-assoc = *-assoc
120 ; *ᵣ-zeroˡ = zeroˡ
121 ; *ᵣ-distribʳ = distribʳ
122 }
123 }
124 } where open Semiring semiring
125
126 bisemimodule : {R : Semiring c ℓ} → Bisemimodule R R c ℓ
127 bisemimodule {R = semiring} = record
128 { isBisemimodule = record
129 { +ᴹ-isCommutativeMonoid = +-isCommutativeMonoid
130 ; isPreleftSemimodule =
131 LeftSemimodule.isPreleftSemimodule leftSemimodule
132 ; isPrerightSemimodule =
133 RightSemimodule.isPrerightSemimodule rightSemimodule
134 ; *ₗ-*ᵣ-assoc = *-assoc
135 }
136 } where open Semiring semiring
137
138 semimodule : {R : CommutativeSemiring c ℓ} → Semimodule R c ℓ
139 semimodule {R = commutativeSemiring} = record
140 { isSemimodule = record
141 { isBisemimodule = Bisemimodule.isBisemimodule bisemimodule
142 ; *ₗ-*ᵣ-coincident = *-comm
143 }
144 } where open CommutativeSemiring commutativeSemiring
145
146 leftModule : {R : Ring c ℓ} → LeftModule R c ℓ
147 leftModule {R = ring} = record
148 { -ᴹ_ = -_
149 ; isLeftModule = record
150 { isLeftSemimodule = LeftSemimodule.isLeftSemimodule leftSemimodule
151 ; -ᴹ‿cong = -‿cong
152 ; -ᴹ‿inverse = -‿inverse
153 }
154 } where open Ring ring
155
156 rightModule : {R : Ring c ℓ} → RightModule R c ℓ
157 rightModule {R = ring} = record
158 { -ᴹ_ = -_
159 ; isRightModule = record
160 { isRightSemimodule = RightSemimodule.isRightSemimodule rightSemimodule
161 ; -ᴹ‿cong = -‿cong
162 ; -ᴹ‿inverse = -‿inverse
163 }
164 } where open Ring ring
165
166 bimodule : {R : Ring c ℓ} → Bimodule R R c ℓ
167 bimodule {R = ring} = record
168 { isBimodule = record
169 { isBisemimodule = Bisemimodule.isBisemimodule bisemimodule
170 ; -ᴹ‿cong = -‿cong
171 ; -ᴹ‿inverse = -‿inverse
172 }
173 } where open Ring ring
174
175 ⟨module⟩ : {R : CommutativeRing c ℓ} → Module R c ℓ
176 ⟨module⟩ {R = commutativeRing} = record
177 { isModule = record
178 { isBimodule = Bimodule.isBimodule bimodule
179 ; *ₗ-*ᵣ-coincident = *-comm
180 }
181 } where open CommutativeRing commutativeRing