-
Notifications
You must be signed in to change notification settings - Fork 245
/
Copy pathComposition.agda
611 lines (508 loc) · 25.8 KB
/
Composition.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
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
------------------------------------------------------------------------
-- The Agda standard library
--
-- The composition of morphisms between algebraic structures.
------------------------------------------------------------------------
{-# OPTIONS --safe --cubical-compatible #-}
module Algebra.Morphism.Construct.Composition where
open import Algebra.Bundles
open import Algebra.Morphism.Bundles
open import Algebra.Morphism.Structures
open import Function.Base using (_∘_)
import Function.Construct.Composition as Func
open import Level using (Level)
open import Relation.Binary.Morphism.Construct.Composition
open import Relation.Binary.Definitions using (Transitive)
private
variable
a b c ℓ₁ ℓ₂ ℓ₃ : Level
------------------------------------------------------------------------
-- Magmas
module _ {M₁ : RawMagma a ℓ₁}
{M₂ : RawMagma b ℓ₂}
{M₃ : RawMagma c ℓ₃}
(open RawMagma)
(≈₃-trans : Transitive (_≈_ M₃))
{f : Carrier M₁ → Carrier M₂}
{g : Carrier M₂ → Carrier M₃}
where
isMagmaHomomorphism
: IsMagmaHomomorphism M₁ M₂ f
→ IsMagmaHomomorphism M₂ M₃ g
→ IsMagmaHomomorphism M₁ M₃ (g ∘ f)
isMagmaHomomorphism f-homo g-homo = record
{ isRelHomomorphism = isRelHomomorphism F.isRelHomomorphism G.isRelHomomorphism
; ∙-homo = λ x y → ≈₃-trans (G.⟦⟧-cong (F.homo x y)) (G.homo (f x) (f y))
} where module F = IsMagmaHomomorphism f-homo; module G = IsMagmaHomomorphism g-homo
isMagmaMonomorphism
: IsMagmaMonomorphism M₁ M₂ f
→ IsMagmaMonomorphism M₂ M₃ g
→ IsMagmaMonomorphism M₁ M₃ (g ∘ f)
isMagmaMonomorphism f-mono g-mono = record
{ isMagmaHomomorphism = isMagmaHomomorphism F.isMagmaHomomorphism G.isMagmaHomomorphism
; injective = F.injective ∘ G.injective
} where module F = IsMagmaMonomorphism f-mono; module G = IsMagmaMonomorphism g-mono
isMagmaIsomorphism
: IsMagmaIsomorphism M₁ M₂ f
→ IsMagmaIsomorphism M₂ M₃ g
→ IsMagmaIsomorphism M₁ M₃ (g ∘ f)
isMagmaIsomorphism f-iso g-iso = record
{ isMagmaMonomorphism = isMagmaMonomorphism F.isMagmaMonomorphism G.isMagmaMonomorphism
; surjective = Func.surjective _ _ (_≈_ M₃) F.surjective G.surjective
} where module F = IsMagmaIsomorphism f-iso; module G = IsMagmaIsomorphism g-iso
------------------------------------------------------------------------
-- Monoids
module _ {M₁ : RawMonoid a ℓ₁}
{M₂ : RawMonoid b ℓ₂}
{M₃ : RawMonoid c ℓ₃}
(open RawMonoid)
(≈₃-trans : Transitive (_≈_ M₃))
{f : Carrier M₁ → Carrier M₂}
{g : Carrier M₂ → Carrier M₃}
where
isMonoidHomomorphism
: IsMonoidHomomorphism M₁ M₂ f
→ IsMonoidHomomorphism M₂ M₃ g
→ IsMonoidHomomorphism M₁ M₃ (g ∘ f)
isMonoidHomomorphism f-homo g-homo = record
{ isMagmaHomomorphism = isMagmaHomomorphism ≈₃-trans F.isMagmaHomomorphism G.isMagmaHomomorphism
; ε-homo = ≈₃-trans (G.⟦⟧-cong F.ε-homo) G.ε-homo
} where module F = IsMonoidHomomorphism f-homo; module G = IsMonoidHomomorphism g-homo
isMonoidMonomorphism
: IsMonoidMonomorphism M₁ M₂ f
→ IsMonoidMonomorphism M₂ M₃ g
→ IsMonoidMonomorphism M₁ M₃ (g ∘ f)
isMonoidMonomorphism f-mono g-mono = record
{ isMonoidHomomorphism = isMonoidHomomorphism F.isMonoidHomomorphism G.isMonoidHomomorphism
; injective = F.injective ∘ G.injective
} where module F = IsMonoidMonomorphism f-mono; module G = IsMonoidMonomorphism g-mono
isMonoidIsomorphism
: IsMonoidIsomorphism M₁ M₂ f
→ IsMonoidIsomorphism M₂ M₃ g
→ IsMonoidIsomorphism M₁ M₃ (g ∘ f)
isMonoidIsomorphism f-iso g-iso = record
{ isMonoidMonomorphism = isMonoidMonomorphism F.isMonoidMonomorphism G.isMonoidMonomorphism
; surjective = Func.surjective _ _(_≈_ M₃) F.surjective G.surjective
} where module F = IsMonoidIsomorphism f-iso; module G = IsMonoidIsomorphism g-iso
------------------------------------------------------------------------
-- Groups
module _ {G₁ : RawGroup a ℓ₁}
{G₂ : RawGroup b ℓ₂}
{G₃ : RawGroup c ℓ₃}
(open RawGroup)
(≈₃-trans : Transitive (_≈_ G₃))
{f : Carrier G₁ → Carrier G₂}
{g : Carrier G₂ → Carrier G₃}
where
isGroupHomomorphism
: IsGroupHomomorphism G₁ G₂ f
→ IsGroupHomomorphism G₂ G₃ g
→ IsGroupHomomorphism G₁ G₃ (g ∘ f)
isGroupHomomorphism f-homo g-homo = record
{ isMonoidHomomorphism = isMonoidHomomorphism ≈₃-trans F.isMonoidHomomorphism G.isMonoidHomomorphism
; ⁻¹-homo = λ x → ≈₃-trans (G.⟦⟧-cong (F.⁻¹-homo x)) (G.⁻¹-homo (f x))
} where module F = IsGroupHomomorphism f-homo; module G = IsGroupHomomorphism g-homo
isGroupMonomorphism
: IsGroupMonomorphism G₁ G₂ f
→ IsGroupMonomorphism G₂ G₃ g
→ IsGroupMonomorphism G₁ G₃ (g ∘ f)
isGroupMonomorphism f-mono g-mono = record
{ isGroupHomomorphism = isGroupHomomorphism F.isGroupHomomorphism G.isGroupHomomorphism
; injective = F.injective ∘ G.injective
} where module F = IsGroupMonomorphism f-mono; module G = IsGroupMonomorphism g-mono
isGroupIsomorphism
: IsGroupIsomorphism G₁ G₂ f
→ IsGroupIsomorphism G₂ G₃ g
→ IsGroupIsomorphism G₁ G₃ (g ∘ f)
isGroupIsomorphism f-iso g-iso = record
{ isGroupMonomorphism = isGroupMonomorphism F.isGroupMonomorphism G.isGroupMonomorphism
; surjective = Func.surjective _ _ (_≈_ G₃) F.surjective G.surjective
} where module F = IsGroupIsomorphism f-iso; module G = IsGroupIsomorphism g-iso
------------------------------------------------------------------------
-- Near semirings
module _ {R₁ : RawNearSemiring a ℓ₁}
{R₂ : RawNearSemiring b ℓ₂}
{R₃ : RawNearSemiring c ℓ₃}
(open RawNearSemiring)
(≈₃-trans : Transitive (_≈_ R₃))
{f : Carrier R₁ → Carrier R₂}
{g : Carrier R₂ → Carrier R₃}
where
isNearSemiringHomomorphism
: IsNearSemiringHomomorphism R₁ R₂ f
→ IsNearSemiringHomomorphism R₂ R₃ g
→ IsNearSemiringHomomorphism R₁ R₃ (g ∘ f)
isNearSemiringHomomorphism f-homo g-homo = record
{ +-isMonoidHomomorphism = isMonoidHomomorphism ≈₃-trans F.+-isMonoidHomomorphism G.+-isMonoidHomomorphism
; *-homo = λ x y → ≈₃-trans (G.⟦⟧-cong (F.*-homo x y)) (G.*-homo (f x) (f y))
} where module F = IsNearSemiringHomomorphism f-homo; module G = IsNearSemiringHomomorphism g-homo
isNearSemiringMonomorphism
: IsNearSemiringMonomorphism R₁ R₂ f
→ IsNearSemiringMonomorphism R₂ R₃ g
→ IsNearSemiringMonomorphism R₁ R₃ (g ∘ f)
isNearSemiringMonomorphism f-mono g-mono = record
{ isNearSemiringHomomorphism = isNearSemiringHomomorphism F.isNearSemiringHomomorphism G.isNearSemiringHomomorphism
; injective = F.injective ∘ G.injective
} where module F = IsNearSemiringMonomorphism f-mono; module G = IsNearSemiringMonomorphism g-mono
isNearSemiringIsomorphism
: IsNearSemiringIsomorphism R₁ R₂ f
→ IsNearSemiringIsomorphism R₂ R₃ g
→ IsNearSemiringIsomorphism R₁ R₃ (g ∘ f)
isNearSemiringIsomorphism f-iso g-iso = record
{ isNearSemiringMonomorphism = isNearSemiringMonomorphism F.isNearSemiringMonomorphism G.isNearSemiringMonomorphism
; surjective = Func.surjective _ _ (_≈_ R₃) F.surjective G.surjective
} where module F = IsNearSemiringIsomorphism f-iso; module G = IsNearSemiringIsomorphism g-iso
------------------------------------------------------------------------
-- Semirings
module _
{R₁ : RawSemiring a ℓ₁}
{R₂ : RawSemiring b ℓ₂}
{R₃ : RawSemiring c ℓ₃}
(open RawSemiring)
(≈₃-trans : Transitive (_≈_ R₃))
{f : Carrier R₁ → Carrier R₂}
{g : Carrier R₂ → Carrier R₃}
where
isSemiringHomomorphism
: IsSemiringHomomorphism R₁ R₂ f
→ IsSemiringHomomorphism R₂ R₃ g
→ IsSemiringHomomorphism R₁ R₃ (g ∘ f)
isSemiringHomomorphism f-homo g-homo = record
{ isNearSemiringHomomorphism = isNearSemiringHomomorphism ≈₃-trans F.isNearSemiringHomomorphism G.isNearSemiringHomomorphism
; 1#-homo = ≈₃-trans (G.⟦⟧-cong F.1#-homo) G.1#-homo
} where module F = IsSemiringHomomorphism f-homo; module G = IsSemiringHomomorphism g-homo
isSemiringMonomorphism
: IsSemiringMonomorphism R₁ R₂ f
→ IsSemiringMonomorphism R₂ R₃ g
→ IsSemiringMonomorphism R₁ R₃ (g ∘ f)
isSemiringMonomorphism f-mono g-mono = record
{ isSemiringHomomorphism = isSemiringHomomorphism F.isSemiringHomomorphism G.isSemiringHomomorphism
; injective = F.injective ∘ G.injective
} where module F = IsSemiringMonomorphism f-mono; module G = IsSemiringMonomorphism g-mono
isSemiringIsomorphism
: IsSemiringIsomorphism R₁ R₂ f
→ IsSemiringIsomorphism R₂ R₃ g
→ IsSemiringIsomorphism R₁ R₃ (g ∘ f)
isSemiringIsomorphism f-iso g-iso = record
{ isSemiringMonomorphism = isSemiringMonomorphism F.isSemiringMonomorphism G.isSemiringMonomorphism
; surjective = Func.surjective _ _ (_≈_ R₃) F.surjective G.surjective
} where module F = IsSemiringIsomorphism f-iso; module G = IsSemiringIsomorphism g-iso
------------------------------------------------------------------------
-- RingWithoutOne
module _ {R₁ : RawRingWithoutOne a ℓ₁}
{R₂ : RawRingWithoutOne b ℓ₂}
{R₃ : RawRingWithoutOne c ℓ₃}
(open RawRingWithoutOne)
(≈₃-trans : Transitive (_≈_ R₃))
{f : Carrier R₁ → Carrier R₂}
{g : Carrier R₂ → Carrier R₃}
where
isRingWithoutOneHomomorphism
: IsRingWithoutOneHomomorphism R₁ R₂ f
→ IsRingWithoutOneHomomorphism R₂ R₃ g
→ IsRingWithoutOneHomomorphism R₁ R₃ (g ∘ f)
isRingWithoutOneHomomorphism f-homo g-homo = record
{ +-isGroupHomomorphism = isGroupHomomorphism ≈₃-trans F.+-isGroupHomomorphism G.+-isGroupHomomorphism
; *-homo = λ x y → ≈₃-trans (G.⟦⟧-cong (F.*-homo x y)) (G.*-homo (f x) (f y))
} where module F = IsRingWithoutOneHomomorphism f-homo; module G = IsRingWithoutOneHomomorphism g-homo
isRingWithoutOneMonomorphism
: IsRingWithoutOneMonomorphism R₁ R₂ f
→ IsRingWithoutOneMonomorphism R₂ R₃ g
→ IsRingWithoutOneMonomorphism R₁ R₃ (g ∘ f)
isRingWithoutOneMonomorphism f-mono g-mono = record
{ isRingWithoutOneHomomorphism = isRingWithoutOneHomomorphism F.isRingWithoutOneHomomorphism G.isRingWithoutOneHomomorphism
; injective = F.injective ∘ G.injective
} where module F = IsRingWithoutOneMonomorphism f-mono; module G = IsRingWithoutOneMonomorphism g-mono
isRingWithoutOneIsoMorphism
: IsRingWithoutOneIsoMorphism R₁ R₂ f
→ IsRingWithoutOneIsoMorphism R₂ R₃ g
→ IsRingWithoutOneIsoMorphism R₁ R₃ (g ∘ f)
isRingWithoutOneIsoMorphism f-iso g-iso = record
{ isRingWithoutOneMonomorphism = isRingWithoutOneMonomorphism F.isRingWithoutOneMonomorphism G.isRingWithoutOneMonomorphism
; surjective = Func.surjective _ _ (_≈_ R₃) F.surjective G.surjective
} where module F = IsRingWithoutOneIsoMorphism f-iso; module G = IsRingWithoutOneIsoMorphism g-iso
------------------------------------------------------------------------
-- Rings
module _ {R₁ : RawRing a ℓ₁}
{R₂ : RawRing b ℓ₂}
{R₃ : RawRing c ℓ₃}
(open RawRing)
(≈₃-trans : Transitive (_≈_ R₃))
{f : Carrier R₁ → Carrier R₂}
{g : Carrier R₂ → Carrier R₃}
where
isRingHomomorphism
: IsRingHomomorphism R₁ R₂ f
→ IsRingHomomorphism R₂ R₃ g
→ IsRingHomomorphism R₁ R₃ (g ∘ f)
isRingHomomorphism f-homo g-homo = record
{ isSemiringHomomorphism = isSemiringHomomorphism ≈₃-trans F.isSemiringHomomorphism G.isSemiringHomomorphism
; -‿homo = λ x → ≈₃-trans (G.⟦⟧-cong (F.-‿homo x)) (G.-‿homo (f x))
} where module F = IsRingHomomorphism f-homo; module G = IsRingHomomorphism g-homo
isRingMonomorphism
: IsRingMonomorphism R₁ R₂ f
→ IsRingMonomorphism R₂ R₃ g
→ IsRingMonomorphism R₁ R₃ (g ∘ f)
isRingMonomorphism f-mono g-mono = record
{ isRingHomomorphism = isRingHomomorphism F.isRingHomomorphism G.isRingHomomorphism
; injective = F.injective ∘ G.injective
} where module F = IsRingMonomorphism f-mono; module G = IsRingMonomorphism g-mono
isRingIsomorphism
: IsRingIsomorphism R₁ R₂ f
→ IsRingIsomorphism R₂ R₃ g
→ IsRingIsomorphism R₁ R₃ (g ∘ f)
isRingIsomorphism f-iso g-iso = record
{ isRingMonomorphism = isRingMonomorphism F.isRingMonomorphism G.isRingMonomorphism
; surjective = Func.surjective _ _ (_≈_ R₃) F.surjective G.surjective
} where module F = IsRingIsomorphism f-iso; module G = IsRingIsomorphism g-iso
------------------------------------------------------------------------
-- Quasigroup
module _ {Q₁ : RawQuasigroup a ℓ₁}
{Q₂ : RawQuasigroup b ℓ₂}
{Q₃ : RawQuasigroup c ℓ₃}
(open RawQuasigroup)
(≈₃-trans : Transitive (_≈_ Q₃))
{f : Carrier Q₁ → Carrier Q₂}
{g : Carrier Q₂ → Carrier Q₃}
where
isQuasigroupHomomorphism
: IsQuasigroupHomomorphism Q₁ Q₂ f
→ IsQuasigroupHomomorphism Q₂ Q₃ g
→ IsQuasigroupHomomorphism Q₁ Q₃ (g ∘ f)
isQuasigroupHomomorphism f-homo g-homo = record
{ isRelHomomorphism = isRelHomomorphism F.isRelHomomorphism G.isRelHomomorphism
; ∙-homo = λ x y → ≈₃-trans (G.⟦⟧-cong ( F.∙-homo x y )) ( G.∙-homo (f x) (f y) )
; \\-homo = λ x y → ≈₃-trans (G.⟦⟧-cong ( F.\\-homo x y )) ( G.\\-homo (f x) (f y) )
; //-homo = λ x y → ≈₃-trans (G.⟦⟧-cong ( F.//-homo x y )) ( G.//-homo (f x) (f y) )
} where module F = IsQuasigroupHomomorphism f-homo; module G = IsQuasigroupHomomorphism g-homo
isQuasigroupMonomorphism
: IsQuasigroupMonomorphism Q₁ Q₂ f
→ IsQuasigroupMonomorphism Q₂ Q₃ g
→ IsQuasigroupMonomorphism Q₁ Q₃ (g ∘ f)
isQuasigroupMonomorphism f-mono g-mono = record
{ isQuasigroupHomomorphism = isQuasigroupHomomorphism F.isQuasigroupHomomorphism G.isQuasigroupHomomorphism
; injective = F.injective ∘ G.injective
} where module F = IsQuasigroupMonomorphism f-mono; module G = IsQuasigroupMonomorphism g-mono
isQuasigroupIsomorphism
: IsQuasigroupIsomorphism Q₁ Q₂ f
→ IsQuasigroupIsomorphism Q₂ Q₃ g
→ IsQuasigroupIsomorphism Q₁ Q₃ (g ∘ f)
isQuasigroupIsomorphism f-iso g-iso = record
{ isQuasigroupMonomorphism = isQuasigroupMonomorphism F.isQuasigroupMonomorphism G.isQuasigroupMonomorphism
; surjective = Func.surjective _ _ (_≈_ Q₃) F.surjective G.surjective
} where module F = IsQuasigroupIsomorphism f-iso; module G = IsQuasigroupIsomorphism g-iso
------------------------------------------------------------------------
-- Loop
module _ {L₁ : RawLoop a ℓ₁}
{L₂ : RawLoop b ℓ₂}
{L₃ : RawLoop c ℓ₃}
(open RawLoop)
(≈₃-trans : Transitive (_≈_ L₃))
{f : Carrier L₁ → Carrier L₂}
{g : Carrier L₂ → Carrier L₃}
where
isLoopHomomorphism
: IsLoopHomomorphism L₁ L₂ f
→ IsLoopHomomorphism L₂ L₃ g
→ IsLoopHomomorphism L₁ L₃ (g ∘ f)
isLoopHomomorphism f-homo g-homo = record
{ isQuasigroupHomomorphism = isQuasigroupHomomorphism ≈₃-trans F.isQuasigroupHomomorphism G.isQuasigroupHomomorphism
; ε-homo = ≈₃-trans (G.⟦⟧-cong F.ε-homo) G.ε-homo
} where module F = IsLoopHomomorphism f-homo; module G = IsLoopHomomorphism g-homo
isLoopMonomorphism
: IsLoopMonomorphism L₁ L₂ f
→ IsLoopMonomorphism L₂ L₃ g
→ IsLoopMonomorphism L₁ L₃ (g ∘ f)
isLoopMonomorphism f-mono g-mono = record
{ isLoopHomomorphism = isLoopHomomorphism F.isLoopHomomorphism G.isLoopHomomorphism
; injective = F.injective ∘ G.injective
} where module F = IsLoopMonomorphism f-mono; module G = IsLoopMonomorphism g-mono
isLoopIsomorphism
: IsLoopIsomorphism L₁ L₂ f
→ IsLoopIsomorphism L₂ L₃ g
→ IsLoopIsomorphism L₁ L₃ (g ∘ f)
isLoopIsomorphism f-iso g-iso = record
{ isLoopMonomorphism = isLoopMonomorphism F.isLoopMonomorphism G.isLoopMonomorphism
; surjective = Func.surjective _ _ (_≈_ L₃) F.surjective G.surjective
} where module F = IsLoopIsomorphism f-iso; module G = IsLoopIsomorphism g-iso
------------------------------------------------------------------------
-- KleeneAlgebra
module _ {K₁ : RawKleeneAlgebra a ℓ₁}
{K₂ : RawKleeneAlgebra b ℓ₂}
{K₃ : RawKleeneAlgebra c ℓ₃}
(open RawKleeneAlgebra)
(≈₃-trans : Transitive (_≈_ K₃))
{f : Carrier K₁ → Carrier K₂}
{g : Carrier K₂ → Carrier K₃}
where
isKleeneAlgebraHomomorphism
: IsKleeneAlgebraHomomorphism K₁ K₂ f
→ IsKleeneAlgebraHomomorphism K₂ K₃ g
→ IsKleeneAlgebraHomomorphism K₁ K₃ (g ∘ f)
isKleeneAlgebraHomomorphism f-homo g-homo = record
{ isSemiringHomomorphism = isSemiringHomomorphism ≈₃-trans F.isSemiringHomomorphism G.isSemiringHomomorphism
; ⋆-homo = λ x → ≈₃-trans (G.⟦⟧-cong (F.⋆-homo x)) (G.⋆-homo (f x))
} where module F = IsKleeneAlgebraHomomorphism f-homo; module G = IsKleeneAlgebraHomomorphism g-homo
isKleeneAlgebraMonomorphism
: IsKleeneAlgebraMonomorphism K₁ K₂ f
→ IsKleeneAlgebraMonomorphism K₂ K₃ g
→ IsKleeneAlgebraMonomorphism K₁ K₃ (g ∘ f)
isKleeneAlgebraMonomorphism f-mono g-mono = record
{ isKleeneAlgebraHomomorphism = isKleeneAlgebraHomomorphism F.isKleeneAlgebraHomomorphism G.isKleeneAlgebraHomomorphism
; injective = F.injective ∘ G.injective
} where module F = IsKleeneAlgebraMonomorphism f-mono; module G = IsKleeneAlgebraMonomorphism g-mono
isKleeneAlgebraIsomorphism
: IsKleeneAlgebraIsomorphism K₁ K₂ f
→ IsKleeneAlgebraIsomorphism K₂ K₃ g
→ IsKleeneAlgebraIsomorphism K₁ K₃ (g ∘ f)
isKleeneAlgebraIsomorphism f-iso g-iso = record
{ isKleeneAlgebraMonomorphism = isKleeneAlgebraMonomorphism F.isKleeneAlgebraMonomorphism G.isKleeneAlgebraMonomorphism
; surjective = Func.surjective (_≈_ K₁) (_≈_ K₂) (_≈_ K₃) F.surjective G.surjective
} where module F = IsKleeneAlgebraIsomorphism f-iso; module G = IsKleeneAlgebraIsomorphism g-iso
-----------------------------------------------------------------------
-- Bundled morphisms between algebras
------------------------------------------------------------------------
-- Magma
module _ {M₁ : Magma a ℓ₁} {M₂ : Magma b ℓ₂} {M₃ : Magma c ℓ₃} where
private
module M₁ = Magma M₁
module M₂ = Magma M₂
module M₃ = Magma M₃
magmaHomomorphism : (h : MagmaHomomorphism M₁.rawMagma M₂.rawMagma) →
(k : MagmaHomomorphism M₂.rawMagma M₃.rawMagma) →
MagmaHomomorphism M₁.rawMagma M₃.rawMagma
magmaHomomorphism h k = record
{ ⟦_⟧ = K.⟦_⟧ ∘ H.⟦_⟧
; isMagmaHomomorphism = isMagmaHomomorphism M₃.trans H.isMagmaHomomorphism K.isMagmaHomomorphism
}
where
module H = MagmaHomomorphism h
module K = MagmaHomomorphism k
-- Monoid
module _ {M₁ : Monoid a ℓ₁} {M₂ : Monoid b ℓ₂} {M₃ : Monoid c ℓ₃} where
private
module M₁ = Monoid M₁
module M₂ = Monoid M₂
module M₃ = Monoid M₃
monoidHomomorphism : (h : MonoidHomomorphism M₁.rawMonoid M₂.rawMonoid) →
(k : MonoidHomomorphism M₂.rawMonoid M₃.rawMonoid) →
MonoidHomomorphism M₁.rawMonoid M₃.rawMonoid
monoidHomomorphism h k = record
{ ⟦_⟧ = K.⟦_⟧ ∘ H.⟦_⟧
; isMonoidHomomorphism = isMonoidHomomorphism M₃.trans H.isMonoidHomomorphism K.isMonoidHomomorphism
}
where
module H = MonoidHomomorphism h
module K = MonoidHomomorphism k
-- Group
module _ {M₁ : Group a ℓ₁} {M₂ : Group b ℓ₂} {M₃ : Group c ℓ₃} where
private
module M₁ = Group M₁
module M₂ = Group M₂
module M₃ = Group M₃
groupHomomorphism : (h : GroupHomomorphism M₁.rawGroup M₂.rawGroup) →
(k : GroupHomomorphism M₂.rawGroup M₃.rawGroup) →
GroupHomomorphism M₁.rawGroup M₃.rawGroup
groupHomomorphism h k = record
{ ⟦_⟧ = K.⟦_⟧ ∘ H.⟦_⟧
; isGroupHomomorphism = isGroupHomomorphism M₃.trans H.isGroupHomomorphism K.isGroupHomomorphism
}
where
module H = GroupHomomorphism h
module K = GroupHomomorphism k
-- NearSemiring
module _ {M₁ : NearSemiring a ℓ₁} {M₂ : NearSemiring b ℓ₂} {M₃ : NearSemiring c ℓ₃} where
private
module M₁ = NearSemiring M₁
module M₂ = NearSemiring M₂
module M₃ = NearSemiring M₃
nearSemiringHomomorphism : (h : NearSemiringHomomorphism M₁.rawNearSemiring M₂.rawNearSemiring) →
(k : NearSemiringHomomorphism M₂.rawNearSemiring M₃.rawNearSemiring) →
NearSemiringHomomorphism M₁.rawNearSemiring M₃.rawNearSemiring
nearSemiringHomomorphism h k = record
{ ⟦_⟧ = K.⟦_⟧ ∘ H.⟦_⟧
; isNearSemiringHomomorphism = isNearSemiringHomomorphism M₃.trans H.isNearSemiringHomomorphism K.isNearSemiringHomomorphism
}
where
module H = NearSemiringHomomorphism h
module K = NearSemiringHomomorphism k
-- Semiring
module _ {M₁ : Semiring a ℓ₁} {M₂ : Semiring b ℓ₂} {M₃ : Semiring c ℓ₃} where
private
module M₁ = Semiring M₁
module M₂ = Semiring M₂
module M₃ = Semiring M₃
semiringHomomorphism : (h : SemiringHomomorphism M₁.rawSemiring M₂.rawSemiring) →
(k : SemiringHomomorphism M₂.rawSemiring M₃.rawSemiring) →
SemiringHomomorphism M₁.rawSemiring M₃.rawSemiring
semiringHomomorphism h k = record
{ ⟦_⟧ = K.⟦_⟧ ∘ H.⟦_⟧
; isSemiringHomomorphism = isSemiringHomomorphism M₃.trans H.isSemiringHomomorphism K.isSemiringHomomorphism
}
where
module H = SemiringHomomorphism h
module K = SemiringHomomorphism k
-- RingWithoutOne
module _ {M₁ : RingWithoutOne a ℓ₁} {M₂ : RingWithoutOne b ℓ₂} {M₃ : RingWithoutOne c ℓ₃} where
private
module M₁ = RingWithoutOne M₁
module M₂ = RingWithoutOne M₂
module M₃ = RingWithoutOne M₃
ringWithoutOneHomomorphism : (h : RingWithoutOneHomomorphism M₁.rawRingWithoutOne M₂.rawRingWithoutOne) →
(k : RingWithoutOneHomomorphism M₂.rawRingWithoutOne M₃.rawRingWithoutOne) →
RingWithoutOneHomomorphism M₁.rawRingWithoutOne M₃.rawRingWithoutOne
ringWithoutOneHomomorphism h k = record
{ ⟦_⟧ = K.⟦_⟧ ∘ H.⟦_⟧
; isRingWithoutOneHomomorphism = isRingWithoutOneHomomorphism M₃.trans H.isRingWithoutOneHomomorphism K.isRingWithoutOneHomomorphism
}
where
module H = RingWithoutOneHomomorphism h
module K = RingWithoutOneHomomorphism k
-- Ring
module _ {M₁ : Ring a ℓ₁} {M₂ : Ring b ℓ₂} {M₃ : Ring c ℓ₃} where
private
module M₁ = Ring M₁
module M₂ = Ring M₂
module M₃ = Ring M₃
ringHomomorphism : (h : RingHomomorphism M₁.rawRing M₂.rawRing) →
(k : RingHomomorphism M₂.rawRing M₃.rawRing) →
RingHomomorphism M₁.rawRing M₃.rawRing
ringHomomorphism h k = record
{ ⟦_⟧ = K.⟦_⟧ ∘ H.⟦_⟧
; isRingHomomorphism = isRingHomomorphism M₃.trans H.isRingHomomorphism K.isRingHomomorphism
}
where
module H = RingHomomorphism h
module K = RingHomomorphism k
-- Quasigroup
module _ {M₁ : Quasigroup a ℓ₁} {M₂ : Quasigroup b ℓ₂} {M₃ : Quasigroup c ℓ₃} where
private
module M₁ = Quasigroup M₁
module M₂ = Quasigroup M₂
module M₃ = Quasigroup M₃
quasigroupHomomorphism : (h : QuasigroupHomomorphism M₁.rawQuasigroup M₂.rawQuasigroup) →
(k : QuasigroupHomomorphism M₂.rawQuasigroup M₃.rawQuasigroup) →
QuasigroupHomomorphism M₁.rawQuasigroup M₃.rawQuasigroup
quasigroupHomomorphism h k = record
{ ⟦_⟧ = K.⟦_⟧ ∘ H.⟦_⟧
; isQuasigroupHomomorphism = isQuasigroupHomomorphism M₃.trans H.isQuasigroupHomomorphism K.isQuasigroupHomomorphism
}
where
module H = QuasigroupHomomorphism h
module K = QuasigroupHomomorphism k
-- Loop
module _ {M₁ : Loop a ℓ₁} {M₂ : Loop b ℓ₂} {M₃ : Loop c ℓ₃} where
private
module M₁ = Loop M₁
module M₂ = Loop M₂
module M₃ = Loop M₃
loopHomomorphism : (h : LoopHomomorphism M₁.rawLoop M₂.rawLoop) →
(k : LoopHomomorphism M₂.rawLoop M₃.rawLoop) →
LoopHomomorphism M₁.rawLoop M₃.rawLoop
loopHomomorphism h k = record
{ ⟦_⟧ = K.⟦_⟧ ∘ H.⟦_⟧
; isLoopHomomorphism = isLoopHomomorphism M₃.trans H.isLoopHomomorphism K.isLoopHomomorphism
}
where
module H = LoopHomomorphism h
module K = LoopHomomorphism k