-
Notifications
You must be signed in to change notification settings - Fork 245
/
Copy pathIdentity.agda
412 lines (314 loc) · 11.9 KB
/
Identity.agda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
------------------------------------------------------------------------
-- The Agda standard library
--
-- The identity morphism for algebraic structures
------------------------------------------------------------------------
{-# OPTIONS --safe --cubical-compatible #-}
module Algebra.Morphism.Construct.Identity where
open import Algebra.Bundles
open import Algebra.Morphism.Bundles
open import Algebra.Morphism.Structures
using ( module MagmaMorphisms
; module MonoidMorphisms
; module GroupMorphisms
; module NearSemiringMorphisms
; module SemiringMorphisms
; module RingWithoutOneMorphisms
; module RingMorphisms
; module QuasigroupMorphisms
; module LoopMorphisms
; module KleeneAlgebraMorphisms
)
open import Function.Base using (id)
import Function.Construct.Identity as Id
open import Level using (Level)
open import Relation.Binary.Morphism.Construct.Identity using (isRelHomomorphism)
open import Relation.Binary.Definitions using (Reflexive)
private
variable
c ℓ : Level
------------------------------------------------------------------------
-- Magmas
module _ (M : RawMagma c ℓ) (open RawMagma M) (refl : Reflexive _≈_) where
open MagmaMorphisms M M
isMagmaHomomorphism : IsMagmaHomomorphism id
isMagmaHomomorphism = record
{ isRelHomomorphism = isRelHomomorphism _
; ∙-homo = λ _ _ → refl
}
isMagmaMonomorphism : IsMagmaMonomorphism id
isMagmaMonomorphism = record
{ isMagmaHomomorphism = isMagmaHomomorphism
; injective = id
}
isMagmaIsomorphism : IsMagmaIsomorphism id
isMagmaIsomorphism = record
{ isMagmaMonomorphism = isMagmaMonomorphism
; surjective = Id.surjective _
}
------------------------------------------------------------------------
-- Monoids
module _ (M : RawMonoid c ℓ) (open RawMonoid M) (refl : Reflexive _≈_) where
open MonoidMorphisms M M
isMonoidHomomorphism : IsMonoidHomomorphism id
isMonoidHomomorphism = record
{ isMagmaHomomorphism = isMagmaHomomorphism _ refl
; ε-homo = refl
}
isMonoidMonomorphism : IsMonoidMonomorphism id
isMonoidMonomorphism = record
{ isMonoidHomomorphism = isMonoidHomomorphism
; injective = id
}
isMonoidIsomorphism : IsMonoidIsomorphism id
isMonoidIsomorphism = record
{ isMonoidMonomorphism = isMonoidMonomorphism
; surjective = Id.surjective _
}
------------------------------------------------------------------------
-- Groups
module _ (G : RawGroup c ℓ) (open RawGroup G) (refl : Reflexive _≈_) where
open GroupMorphisms G G
isGroupHomomorphism : IsGroupHomomorphism id
isGroupHomomorphism = record
{ isMonoidHomomorphism = isMonoidHomomorphism _ refl
; ⁻¹-homo = λ _ → refl
}
isGroupMonomorphism : IsGroupMonomorphism id
isGroupMonomorphism = record
{ isGroupHomomorphism = isGroupHomomorphism
; injective = id
}
isGroupIsomorphism : IsGroupIsomorphism id
isGroupIsomorphism = record
{ isGroupMonomorphism = isGroupMonomorphism
; surjective = Id.surjective _
}
------------------------------------------------------------------------
-- Near semirings
module _ (R : RawNearSemiring c ℓ) (open RawNearSemiring R) (refl : Reflexive _≈_) where
open NearSemiringMorphisms R R
isNearSemiringHomomorphism : IsNearSemiringHomomorphism id
isNearSemiringHomomorphism = record
{ +-isMonoidHomomorphism = isMonoidHomomorphism _ refl
; *-homo = λ _ _ → refl
}
isNearSemiringMonomorphism : IsNearSemiringMonomorphism id
isNearSemiringMonomorphism = record
{ isNearSemiringHomomorphism = isNearSemiringHomomorphism
; injective = id
}
isNearSemiringIsomorphism : IsNearSemiringIsomorphism id
isNearSemiringIsomorphism = record
{ isNearSemiringMonomorphism = isNearSemiringMonomorphism
; surjective = Id.surjective _
}
------------------------------------------------------------------------
-- Semirings
module _ (R : RawSemiring c ℓ) (open RawSemiring R) (refl : Reflexive _≈_) where
open SemiringMorphisms R R
isSemiringHomomorphism : IsSemiringHomomorphism id
isSemiringHomomorphism = record
{ isNearSemiringHomomorphism = isNearSemiringHomomorphism _ refl
; 1#-homo = refl
}
isSemiringMonomorphism : IsSemiringMonomorphism id
isSemiringMonomorphism = record
{ isSemiringHomomorphism = isSemiringHomomorphism
; injective = id
}
isSemiringIsomorphism : IsSemiringIsomorphism id
isSemiringIsomorphism = record
{ isSemiringMonomorphism = isSemiringMonomorphism
; surjective = Id.surjective _
}
------------------------------------------------------------------------
-- RingWithoutOne
module _ (R : RawRingWithoutOne c ℓ) (open RawRingWithoutOne R) (refl : Reflexive _≈_) where
open RingWithoutOneMorphisms R R
isRingWithoutOneHomomorphism : IsRingWithoutOneHomomorphism id
isRingWithoutOneHomomorphism = record
{ +-isGroupHomomorphism = isGroupHomomorphism _ refl
; *-homo = λ _ _ → refl
}
isRingWithoutOneMonomorphism : IsRingWithoutOneMonomorphism id
isRingWithoutOneMonomorphism = record
{ isRingWithoutOneHomomorphism = isRingWithoutOneHomomorphism
; injective = id
}
isRingWithoutOneIsoMorphism : IsRingWithoutOneIsoMorphism id
isRingWithoutOneIsoMorphism = record
{ isRingWithoutOneMonomorphism = isRingWithoutOneMonomorphism
; surjective = Id.surjective _
}
------------------------------------------------------------------------
-- Rings
module _ (R : RawRing c ℓ) (open RawRing R) (refl : Reflexive _≈_) where
open RingMorphisms R R
isRingHomomorphism : IsRingHomomorphism id
isRingHomomorphism = record
{ isSemiringHomomorphism = isSemiringHomomorphism _ refl
; -‿homo = λ _ → refl
}
isRingMonomorphism : IsRingMonomorphism id
isRingMonomorphism = record
{ isRingHomomorphism = isRingHomomorphism
; injective = id
}
isRingIsomorphism : IsRingIsomorphism id
isRingIsomorphism = record
{ isRingMonomorphism = isRingMonomorphism
; surjective = Id.surjective _
}
------------------------------------------------------------------------
-- Quasigroup
module _ (Q : RawQuasigroup c ℓ) (open RawQuasigroup Q) (refl : Reflexive _≈_) where
open QuasigroupMorphisms Q Q
isQuasigroupHomomorphism : IsQuasigroupHomomorphism id
isQuasigroupHomomorphism = record
{ isRelHomomorphism = isRelHomomorphism _
; ∙-homo = λ _ _ → refl
; \\-homo = λ _ _ → refl
; //-homo = λ _ _ → refl
}
isQuasigroupMonomorphism : IsQuasigroupMonomorphism id
isQuasigroupMonomorphism = record
{ isQuasigroupHomomorphism = isQuasigroupHomomorphism
; injective = id
}
isQuasigroupIsomorphism : IsQuasigroupIsomorphism id
isQuasigroupIsomorphism = record
{ isQuasigroupMonomorphism = isQuasigroupMonomorphism
; surjective = Id.surjective _
}
------------------------------------------------------------------------
-- Loop
module _ (L : RawLoop c ℓ) (open RawLoop L) (refl : Reflexive _≈_) where
open LoopMorphisms L L
isLoopHomomorphism : IsLoopHomomorphism id
isLoopHomomorphism = record
{ isQuasigroupHomomorphism = isQuasigroupHomomorphism _ refl
; ε-homo = refl
}
isLoopMonomorphism : IsLoopMonomorphism id
isLoopMonomorphism = record
{ isLoopHomomorphism = isLoopHomomorphism
; injective = id
}
isLoopIsomorphism : IsLoopIsomorphism id
isLoopIsomorphism = record
{ isLoopMonomorphism = isLoopMonomorphism
; surjective = Id.surjective _
}
------------------------------------------------------------------------
-- KleeneAlgebra
module _ (K : RawKleeneAlgebra c ℓ) (open RawKleeneAlgebra K) (refl : Reflexive _≈_) where
open KleeneAlgebraMorphisms K K
isKleeneAlgebraHomomorphism : IsKleeneAlgebraHomomorphism id
isKleeneAlgebraHomomorphism = record
{ isSemiringHomomorphism = isSemiringHomomorphism _ refl
; ⋆-homo = λ _ → refl
}
isKleeneAlgebraMonomorphism : IsKleeneAlgebraMonomorphism id
isKleeneAlgebraMonomorphism = record
{ isKleeneAlgebraHomomorphism = isKleeneAlgebraHomomorphism
; injective = id
}
isKleeneAlgebraIsomorphism : IsKleeneAlgebraIsomorphism id
isKleeneAlgebraIsomorphism = record
{ isKleeneAlgebraMonomorphism = isKleeneAlgebraMonomorphism
; surjective = Id.surjective _
}
------------------------------------------------------------------------
--- Bundled morphisms between algebras
-----------------------------------------------------------------------
-- Magma
module _ (M : Magma c ℓ) where
open Magma M using (rawMagma; refl)
open MagmaMorphisms rawMagma rawMagma
magmaHomomorphism : MagmaHomomorphism rawMagma rawMagma
magmaHomomorphism = record
{ ⟦_⟧ = id
; isMagmaHomomorphism = isMagmaHomomorphism rawMagma refl
}
-- Monoid
module _ (M : Monoid c ℓ) where
open Monoid M using (rawMonoid; refl)
open MonoidMorphisms rawMonoid rawMonoid
monoidHomomorphism : MonoidHomomorphism rawMonoid rawMonoid
monoidHomomorphism = record
{ ⟦_⟧ = id
; isMonoidHomomorphism = isMonoidHomomorphism rawMonoid refl
}
-- Group
module _ (M : Group c ℓ) where
open Group M using (rawGroup; refl)
open GroupMorphisms rawGroup rawGroup
groupHomomorphism : GroupHomomorphism rawGroup rawGroup
groupHomomorphism = record
{ ⟦_⟧ = id
; isGroupHomomorphism = isGroupHomomorphism rawGroup refl
}
-- NearSemiring
module _ (M : NearSemiring c ℓ) where
open NearSemiring M using (rawNearSemiring; refl)
open NearSemiringMorphisms rawNearSemiring rawNearSemiring
nearSemiringHomomorphism : NearSemiringHomomorphism rawNearSemiring rawNearSemiring
nearSemiringHomomorphism = record
{ ⟦_⟧ = id
; isNearSemiringHomomorphism = isNearSemiringHomomorphism rawNearSemiring refl
}
-- Semiring
module _ (M : Semiring c ℓ) where
open Semiring M using (rawSemiring; refl)
open SemiringMorphisms rawSemiring rawSemiring
semiringHomomorphism : SemiringHomomorphism rawSemiring rawSemiring
semiringHomomorphism = record
{ ⟦_⟧ = id
; isSemiringHomomorphism = isSemiringHomomorphism rawSemiring refl
}
-- KleeneAlgebra
module _ (M : KleeneAlgebra c ℓ) where
open KleeneAlgebra M using (rawKleeneAlgebra; refl)
open KleeneAlgebraMorphisms rawKleeneAlgebra rawKleeneAlgebra
kleeneAlgebraHomomorphism : KleeneAlgebraHomomorphism rawKleeneAlgebra rawKleeneAlgebra
kleeneAlgebraHomomorphism = record
{ ⟦_⟧ = id
; isKleeneAlgebraHomomorphism = isKleeneAlgebraHomomorphism rawKleeneAlgebra refl
}
-- RingWithoutOne
module _ (M : RingWithoutOne c ℓ) where
open RingWithoutOne M using (rawRingWithoutOne; refl)
open RingWithoutOneMorphisms rawRingWithoutOne rawRingWithoutOne
ringWithoutOneHomomorphism : RingWithoutOneHomomorphism rawRingWithoutOne rawRingWithoutOne
ringWithoutOneHomomorphism = record
{ ⟦_⟧ = id
; isRingWithoutOneHomomorphism = isRingWithoutOneHomomorphism rawRingWithoutOne refl
}
-- Ring
module _ (M : Ring c ℓ) where
open Ring M using (rawRing; refl)
open RingMorphisms rawRing rawRing
ringHomomorphism : RingHomomorphism rawRing rawRing
ringHomomorphism = record
{ ⟦_⟧ = id
; isRingHomomorphism = isRingHomomorphism rawRing refl
}
-- Quasigroup
module _ (M : Quasigroup c ℓ) where
open Quasigroup M using (rawQuasigroup; refl)
open QuasigroupMorphisms rawQuasigroup rawQuasigroup
quasigroupHomomorphism : QuasigroupHomomorphism rawQuasigroup rawQuasigroup
quasigroupHomomorphism = record
{ ⟦_⟧ = id
; isQuasigroupHomomorphism = isQuasigroupHomomorphism rawQuasigroup refl
}
-- Loop
module _ (M : Loop c ℓ) where
open Loop M using (rawLoop; refl)
open LoopMorphisms rawLoop rawLoop
loopHomomorphism : LoopHomomorphism rawLoop rawLoop
loopHomomorphism = record
{ ⟦_⟧ = id
; isLoopHomomorphism = isLoopHomomorphism rawLoop refl
}