Debian Codegraph @

src/Algebra/Bundles.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Definitions of algebraic structures like monoids and rings
5 -- (packed in records together with sets, operations, etc.)
6 ------------------------------------------------------------------------
7
8 -- The contents of this module should be accessed via `Algebra`.
9
10 {-# OPTIONS --cubical-compatible --safe #-}
11
12 module Algebra.Bundles where
13
14 import Algebra.Bundles.Raw as Raw
15 open import Algebra.Core
16 open import Algebra.Structures
17 open import Relation.Binary.Core using (Rel)
18 open import Level
19
20 ------------------------------------------------------------------------
21 -- Re-export definitions of 'raw' bundles
22
23 open Raw public
24 using ( RawSuccessorSet; RawMagma; RawMonoid; RawGroup
25 ; RawNearSemiring; RawSemiring
26 ; RawRingWithoutOne; RawRing
27 ; RawQuasigroup; RawLoop; RawKleeneAlgebra)
28
29 ------------------------------------------------------------------------
30 -- Bundles with 1 unary operation & 1 element
31 ------------------------------------------------------------------------
32
33 record SuccessorSet c ℓ : Set (suc (c ⊔ ℓ)) where
34 infix 4 _≈_
35 field
36 Carrier : Set c
37 _≈_ : Rel Carrier ℓ
38 suc# : Op₁ Carrier
39 zero# : Carrier
40 isSuccessorSet : IsSuccessorSet _≈_ suc# zero#
41
42 open IsSuccessorSet isSuccessorSet public
43
44 rawSuccessorSet : RawSuccessorSet _ _
45 rawSuccessorSet = record { _≈_ = _≈_; suc# = suc#; zero# = zero# }
46
47 open RawSuccessorSet rawSuccessorSet public
48
49 ------------------------------------------------------------------------
50 -- Bundles with 1 binary operation
51 ------------------------------------------------------------------------
52
53 record Magma c ℓ : Set (suc (c ⊔ ℓ)) where
54 infixl 7 _∙_
55 infix 4 _≈_
56 field
57 Carrier : Set c
58 _≈_ : Rel Carrier ℓ
59 _∙_ : Op₂ Carrier
60 isMagma : IsMagma _≈_ _∙_
61
62 open IsMagma isMagma public
63
64 rawMagma : RawMagma _ _
65 rawMagma = record { _≈_ = _≈_; _∙_ = _∙_ }
66
67 open RawMagma rawMagma public
68 using (_≉_)
69
70
71 record SelectiveMagma c ℓ : Set (suc (c ⊔ ℓ)) where
72 infixl 7 _∙_
73 infix 4 _≈_
74 field
75 Carrier : Set c
76 _≈_ : Rel Carrier ℓ
77 _∙_ : Op₂ Carrier
78 isSelectiveMagma : IsSelectiveMagma _≈_ _∙_
79
80 open IsSelectiveMagma isSelectiveMagma public
81
82 magma : Magma c ℓ
83 magma = record { isMagma = isMagma }
84
85 open Magma magma public using (rawMagma)
86
87
88 record CommutativeMagma c ℓ : Set (suc (c ⊔ ℓ)) where
89 infixl 7 _∙_
90 infix 4 _≈_
91 field
92 Carrier : Set c
93 _≈_ : Rel Carrier ℓ
94 _∙_ : Op₂ Carrier
95 isCommutativeMagma : IsCommutativeMagma _≈_ _∙_
96
97 open IsCommutativeMagma isCommutativeMagma public
98
99 magma : Magma c ℓ
100 magma = record { isMagma = isMagma }
101
102 open Magma magma public using (rawMagma)
103
104 record IdempotentMagma c ℓ : Set (suc (c ⊔ ℓ)) where
105 infixl 7 _∙_
106 infix 4 _≈_
107 field
108 Carrier : Set c
109 _≈_ : Rel Carrier ℓ
110 _∙_ : Op₂ Carrier
111 isIdempotentMagma : IsIdempotentMagma _≈_ _∙_
112
113 open IsIdempotentMagma isIdempotentMagma public
114
115 magma : Magma c ℓ
116 magma = record { isMagma = isMagma }
117
118 open Magma magma public
119 using (rawMagma)
120
121 record AlternativeMagma c ℓ : Set (suc (c ⊔ ℓ)) where
122 infixl 7 _∙_
123 infix 4 _≈_
124 field
125 Carrier : Set c
126 _≈_ : Rel Carrier ℓ
127 _∙_ : Op₂ Carrier
128 isAlternativeMagma : IsAlternativeMagma _≈_ _∙_
129
130 open IsAlternativeMagma isAlternativeMagma public
131
132 magma : Magma c ℓ
133 magma = record { isMagma = isMagma }
134
135 open Magma magma public
136 using (rawMagma)
137
138 record FlexibleMagma c ℓ : Set (suc (c ⊔ ℓ)) where
139 infixl 7 _∙_
140 infix 4 _≈_
141 field
142 Carrier : Set c
143 _≈_ : Rel Carrier ℓ
144 _∙_ : Op₂ Carrier
145 isFlexibleMagma : IsFlexibleMagma _≈_ _∙_
146
147 open IsFlexibleMagma isFlexibleMagma public
148
149 magma : Magma c ℓ
150 magma = record { isMagma = isMagma }
151
152 open Magma magma public
153 using (rawMagma)
154
155 record MedialMagma c ℓ : Set (suc (c ⊔ ℓ)) where
156 infixl 7 _∙_
157 infix 4 _≈_
158 field
159 Carrier : Set c
160 _≈_ : Rel Carrier ℓ
161 _∙_ : Op₂ Carrier
162 isMedialMagma : IsMedialMagma _≈_ _∙_
163
164 open IsMedialMagma isMedialMagma public
165
166 magma : Magma c ℓ
167 magma = record { isMagma = isMagma }
168
169 open Magma magma public
170 using (rawMagma)
171
172 record SemimedialMagma c ℓ : Set (suc (c ⊔ ℓ)) where
173 infixl 7 _∙_
174 infix 4 _≈_
175 field
176 Carrier : Set c
177 _≈_ : Rel Carrier ℓ
178 _∙_ : Op₂ Carrier
179 isSemimedialMagma : IsSemimedialMagma _≈_ _∙_
180
181 open IsSemimedialMagma isSemimedialMagma public
182
183 magma : Magma c ℓ
184 magma = record { isMagma = isMagma }
185
186 open Magma magma public
187 using (rawMagma)
188
189
190 record Semigroup c ℓ : Set (suc (c ⊔ ℓ)) where
191 infixl 7 _∙_
192 infix 4 _≈_
193 field
194 Carrier : Set c
195 _≈_ : Rel Carrier ℓ
196 _∙_ : Op₂ Carrier
197 isSemigroup : IsSemigroup _≈_ _∙_
198
199 open IsSemigroup isSemigroup public
200
201 magma : Magma c ℓ
202 magma = record { isMagma = isMagma }
203
204 open Magma magma public
205 using (_≉_; rawMagma)
206
207
208 record Band c ℓ : Set (suc (c ⊔ ℓ)) where
209 infixl 7 _∙_
210 infix 4 _≈_
211 field
212 Carrier : Set c
213 _≈_ : Rel Carrier ℓ
214 _∙_ : Op₂ Carrier
215 isBand : IsBand _≈_ _∙_
216
217 open IsBand isBand public
218
219 semigroup : Semigroup c ℓ
220 semigroup = record { isSemigroup = isSemigroup }
221
222 open Semigroup semigroup public
223 using (_≉_; magma; rawMagma)
224
225
226 record CommutativeSemigroup c ℓ : Set (suc (c ⊔ ℓ)) where
227 infixl 7 _∙_
228 infix 4 _≈_
229 field
230 Carrier : Set c
231 _≈_ : Rel Carrier ℓ
232 _∙_ : Op₂ Carrier
233 isCommutativeSemigroup : IsCommutativeSemigroup _≈_ _∙_
234
235 open IsCommutativeSemigroup isCommutativeSemigroup public
236
237 semigroup : Semigroup c ℓ
238 semigroup = record { isSemigroup = isSemigroup }
239
240 open Semigroup semigroup public
241 using (_≉_; magma; rawMagma)
242
243 commutativeMagma : CommutativeMagma c ℓ
244 commutativeMagma = record { isCommutativeMagma = isCommutativeMagma }
245
246 record CommutativeBand c ℓ : Set (suc (c ⊔ ℓ)) where
247 infixl 7 _∙_
248 infix 4 _≈_
249 field
250 Carrier : Set c
251 _≈_ : Rel Carrier ℓ
252 _∙_ : Op₂ Carrier
253 isCommutativeBand : IsCommutativeBand _≈_ _∙_
254
255 open IsCommutativeBand isCommutativeBand public
256
257 band : Band _ _
258 band = record { isBand = isBand }
259
260 open Band band public
261 using (_≉_; magma; rawMagma; semigroup)
262
263 commutativeSemigroup : CommutativeSemigroup c ℓ
264 commutativeSemigroup = record { isCommutativeSemigroup = isCommutativeSemigroup }
265
266 open CommutativeSemigroup commutativeSemigroup public
267 using (commutativeMagma)
268
269
270 ------------------------------------------------------------------------
271 -- Bundles with 1 binary operation & 1 element
272 ------------------------------------------------------------------------
273
274 record UnitalMagma c ℓ : Set (suc (c ⊔ ℓ)) where
275 infixl 7 _∙_
276 infix 4 _≈_
277 field
278 Carrier : Set c
279 _≈_ : Rel Carrier ℓ
280 _∙_ : Op₂ Carrier
281 ε : Carrier
282 isUnitalMagma : IsUnitalMagma _≈_ _∙_ ε
283
284 open IsUnitalMagma isUnitalMagma public
285
286 magma : Magma c ℓ
287 magma = record { isMagma = isMagma }
288
289 open Magma magma public
290 using (_≉_; rawMagma)
291
292
293 record Monoid c ℓ : Set (suc (c ⊔ ℓ)) where
294 infixl 7 _∙_
295 infix 4 _≈_
296 field
297 Carrier : Set c
298 _≈_ : Rel Carrier ℓ
299 _∙_ : Op₂ Carrier
300 ε : Carrier
301 isMonoid : IsMonoid _≈_ _∙_ ε
302
303 open IsMonoid isMonoid public
304
305 semigroup : Semigroup _ _
306 semigroup = record { isSemigroup = isSemigroup }
307
308 open Semigroup semigroup public
309 using (_≉_; rawMagma; magma)
310
311 rawMonoid : RawMonoid _ _
312 rawMonoid = record { _≈_ = _≈_; _∙_ = _∙_; ε = ε}
313
314 unitalMagma : UnitalMagma _ _
315 unitalMagma = record { isUnitalMagma = isUnitalMagma }
316
317
318 record CommutativeMonoid c ℓ : Set (suc (c ⊔ ℓ)) where
319 infixl 7 _∙_
320 infix 4 _≈_
321 field
322 Carrier : Set c
323 _≈_ : Rel Carrier ℓ
324 _∙_ : Op₂ Carrier
325 ε : Carrier
326 isCommutativeMonoid : IsCommutativeMonoid _≈_ _∙_ ε
327
328 open IsCommutativeMonoid isCommutativeMonoid public
329
330 monoid : Monoid _ _
331 monoid = record { isMonoid = isMonoid }
332
333 open Monoid monoid public
334 using (_≉_; rawMagma; magma; semigroup; unitalMagma; rawMonoid)
335
336 commutativeSemigroup : CommutativeSemigroup _ _
337 commutativeSemigroup = record { isCommutativeSemigroup = isCommutativeSemigroup }
338
339 open CommutativeSemigroup commutativeSemigroup public
340 using (commutativeMagma)
341
342 record IdempotentMonoid c ℓ : Set (suc (c ⊔ ℓ)) where
343 infixl 7 _∙_
344 infix 4 _≈_
345 field
346 Carrier : Set c
347 _≈_ : Rel Carrier ℓ
348 _∙_ : Op₂ Carrier
349 ε : Carrier
350 isIdempotentMonoid : IsIdempotentMonoid _≈_ _∙_ ε
351
352 open IsIdempotentMonoid isIdempotentMonoid public
353
354 monoid : Monoid _ _
355 monoid = record { isMonoid = isMonoid }
356
357 open Monoid monoid public
358 using (_≉_; rawMagma; magma; semigroup; unitalMagma; rawMonoid)
359
360 band : Band _ _
361 band = record { isBand = isBand }
362
363
364 record IdempotentCommutativeMonoid c ℓ : Set (suc (c ⊔ ℓ)) where
365 infixl 7 _∙_
366 infix 4 _≈_
367 field
368 Carrier : Set c
369 _≈_ : Rel Carrier ℓ
370 _∙_ : Op₂ Carrier
371 ε : Carrier
372 isIdempotentCommutativeMonoid : IsIdempotentCommutativeMonoid _≈_ _∙_ ε
373
374 open IsIdempotentCommutativeMonoid isIdempotentCommutativeMonoid public
375
376 commutativeMonoid : CommutativeMonoid _ _
377 commutativeMonoid = record { isCommutativeMonoid = isCommutativeMonoid }
378
379 idempotentMonoid : IdempotentMonoid _ _
380 idempotentMonoid = record { isIdempotentMonoid = isIdempotentMonoid }
381
382 commutativeBand : CommutativeBand _ _
383 commutativeBand = record { isCommutativeBand = isCommutativeBand }
384
385 open CommutativeMonoid commutativeMonoid public
386 using
387 ( _≉_; rawMagma; magma; unitalMagma; commutativeMagma
388 ; semigroup; commutativeSemigroup
389 ; rawMonoid; monoid
390 )
391
392 open CommutativeBand commutativeBand public
393 using (band)
394
395 -- Idempotent commutative monoids are also known as bounded lattices.
396 -- Note that the BoundedLattice necessarily uses the notation inherited
397 -- from monoids rather than lattices.
398
399 BoundedLattice = IdempotentCommutativeMonoid
400
401 module BoundedLattice {c ℓ} (idemCommMonoid : IdempotentCommutativeMonoid c ℓ) =
402 IdempotentCommutativeMonoid idemCommMonoid
403
404
405 ------------------------------------------------------------------------
406 -- Bundles with 1 binary operation, 1 unary operation & 1 element
407 ------------------------------------------------------------------------
408
409 record InvertibleMagma c ℓ : Set (suc (c ⊔ ℓ)) where
410 infix 8 _⁻¹
411 infixl 7 _∙_
412 infix 4 _≈_
413 field
414 Carrier : Set c
415 _≈_ : Rel Carrier ℓ
416 _∙_ : Op₂ Carrier
417 ε : Carrier
418 _⁻¹ : Op₁ Carrier
419 isInvertibleMagma : IsInvertibleMagma _≈_ _∙_ ε _⁻¹
420
421 open IsInvertibleMagma isInvertibleMagma public
422
423 magma : Magma _ _
424 magma = record { isMagma = isMagma }
425
426 open Magma magma public
427 using (_≉_; rawMagma)
428
429
430 record InvertibleUnitalMagma c ℓ : Set (suc (c ⊔ ℓ)) where
431 infix 8 _⁻¹
432 infixl 7 _∙_
433 infix 4 _≈_
434 field
435 Carrier : Set c
436 _≈_ : Rel Carrier ℓ
437 _∙_ : Op₂ Carrier
438 ε : Carrier
439 _⁻¹ : Op₁ Carrier
440 isInvertibleUnitalMagma : IsInvertibleUnitalMagma _≈_ _∙_ ε _⁻¹
441
442 open IsInvertibleUnitalMagma isInvertibleUnitalMagma public
443
444 invertibleMagma : InvertibleMagma _ _
445 invertibleMagma = record { isInvertibleMagma = isInvertibleMagma }
446
447 open InvertibleMagma invertibleMagma public
448 using (_≉_; rawMagma; magma)
449
450 record Group c ℓ : Set (suc (c ⊔ ℓ)) where
451 infix 8 _⁻¹
452 infixl 7 _∙_
453 infix 4 _≈_
454 field
455 Carrier : Set c
456 _≈_ : Rel Carrier ℓ
457 _∙_ : Op₂ Carrier
458 ε : Carrier
459 _⁻¹ : Op₁ Carrier
460 isGroup : IsGroup _≈_ _∙_ ε _⁻¹
461
462 open IsGroup isGroup public
463
464 rawGroup : RawGroup _ _
465 rawGroup = record { _≈_ = _≈_; _∙_ = _∙_; ε = ε; _⁻¹ = _⁻¹}
466
467 monoid : Monoid _ _
468 monoid = record { isMonoid = isMonoid }
469
470 open Monoid monoid public
471 using (_≉_; rawMagma; magma; semigroup; unitalMagma; rawMonoid)
472
473 invertibleMagma : InvertibleMagma c ℓ
474 invertibleMagma = record
475 { isInvertibleMagma = isInvertibleMagma
476 }
477
478 invertibleUnitalMagma : InvertibleUnitalMagma c ℓ
479 invertibleUnitalMagma = record
480 { isInvertibleUnitalMagma = isInvertibleUnitalMagma
481 }
482
483 record AbelianGroup c ℓ : Set (suc (c ⊔ ℓ)) where
484 infix 8 _⁻¹
485 infixl 7 _∙_
486 infix 4 _≈_
487 field
488 Carrier : Set c
489 _≈_ : Rel Carrier ℓ
490 _∙_ : Op₂ Carrier
491 ε : Carrier
492 _⁻¹ : Op₁ Carrier
493 isAbelianGroup : IsAbelianGroup _≈_ _∙_ ε _⁻¹
494
495 open IsAbelianGroup isAbelianGroup public
496
497 group : Group _ _
498 group = record { isGroup = isGroup }
499
500 open Group group public using
501 (_≉_; rawMagma; magma; semigroup
502 ; rawMonoid; monoid; rawGroup; invertibleMagma; invertibleUnitalMagma
503 )
504
505 commutativeMonoid : CommutativeMonoid _ _
506 commutativeMonoid = record { isCommutativeMonoid = isCommutativeMonoid }
507
508 open CommutativeMonoid commutativeMonoid public
509 using (commutativeMagma; commutativeSemigroup)
510
511 ------------------------------------------------------------------------
512 -- Bundles with 2 binary operations & 1 element
513 ------------------------------------------------------------------------
514
515 record NearSemiring c ℓ : Set (suc (c ⊔ ℓ)) where
516 infixl 7 _*_
517 infixl 6 _+_
518 infix 4 _≈_
519 field
520 Carrier : Set c
521 _≈_ : Rel Carrier ℓ
522 _+_ : Op₂ Carrier
523 _*_ : Op₂ Carrier
524 0# : Carrier
525 isNearSemiring : IsNearSemiring _≈_ _+_ _*_ 0#
526
527 open IsNearSemiring isNearSemiring public
528
529 rawNearSemiring : RawNearSemiring _ _
530 rawNearSemiring = record
531 { _≈_ = _≈_
532 ; _+_ = _+_
533 ; _*_ = _*_
534 ; 0# = 0#
535 }
536
537 +-monoid : Monoid _ _
538 +-monoid = record { isMonoid = +-isMonoid }
539
540 open Monoid +-monoid public
541 using (_≉_) renaming
542 ( rawMagma to +-rawMagma
543 ; magma to +-magma
544 ; semigroup to +-semigroup
545 ; unitalMagma to +-unitalMagma
546 ; rawMonoid to +-rawMonoid
547 )
548
549 *-semigroup : Semigroup _ _
550 *-semigroup = record { isSemigroup = *-isSemigroup }
551
552 open Semigroup *-semigroup public
553 using () renaming
554 ( rawMagma to *-rawMagma
555 ; magma to *-magma
556 )
557
558
559 record SemiringWithoutOne c ℓ : Set (suc (c ⊔ ℓ)) where
560 infixl 7 _*_
561 infixl 6 _+_
562 infix 4 _≈_
563 field
564 Carrier : Set c
565 _≈_ : Rel Carrier ℓ
566 _+_ : Op₂ Carrier
567 _*_ : Op₂ Carrier
568 0# : Carrier
569 isSemiringWithoutOne : IsSemiringWithoutOne _≈_ _+_ _*_ 0#
570
571 open IsSemiringWithoutOne isSemiringWithoutOne public
572
573 nearSemiring : NearSemiring _ _
574 nearSemiring = record { isNearSemiring = isNearSemiring }
575
576 open NearSemiring nearSemiring public
577 using
578 ( +-rawMagma; +-magma; +-unitalMagma; +-semigroup
579 ; +-rawMonoid; +-monoid
580 ; *-rawMagma; *-magma; *-semigroup
581 ; rawNearSemiring
582 )
583
584 +-commutativeMonoid : CommutativeMonoid _ _
585 +-commutativeMonoid = record { isCommutativeMonoid = +-isCommutativeMonoid }
586
587 open CommutativeMonoid +-commutativeMonoid public
588 using () renaming
589 ( commutativeMagma to +-commutativeMagma
590 ; commutativeSemigroup to +-commutativeSemigroup
591 )
592
593
594 record CommutativeSemiringWithoutOne c ℓ : Set (suc (c ⊔ ℓ)) where
595 infixl 7 _*_
596 infixl 6 _+_
597 infix 4 _≈_
598 field
599 Carrier : Set c
600 _≈_ : Rel Carrier ℓ
601 _+_ : Op₂ Carrier
602 _*_ : Op₂ Carrier
603 0# : Carrier
604 isCommutativeSemiringWithoutOne :
605 IsCommutativeSemiringWithoutOne _≈_ _+_ _*_ 0#
606
607 open IsCommutativeSemiringWithoutOne
608 isCommutativeSemiringWithoutOne public
609
610 semiringWithoutOne : SemiringWithoutOne _ _
611 semiringWithoutOne =
612 record { isSemiringWithoutOne = isSemiringWithoutOne }
613
614 open SemiringWithoutOne semiringWithoutOne public
615 using
616 ( +-rawMagma; +-magma; +-unitalMagma; +-semigroup; +-commutativeSemigroup
617 ; *-rawMagma; *-magma; *-semigroup
618 ; +-rawMonoid; +-monoid; +-commutativeMonoid
619 ; nearSemiring; rawNearSemiring
620 )
621
622 ------------------------------------------------------------------------
623 -- Bundles with 2 binary operations & 2 elements
624 ------------------------------------------------------------------------
625
626 record SemiringWithoutAnnihilatingZero c ℓ : Set (suc (c ⊔ ℓ)) where
627 infixl 7 _*_
628 infixl 6 _+_
629 infix 4 _≈_
630 field
631 Carrier : Set c
632 _≈_ : Rel Carrier ℓ
633 _+_ : Op₂ Carrier
634 _*_ : Op₂ Carrier
635 0# : Carrier
636 1# : Carrier
637 isSemiringWithoutAnnihilatingZero :
638 IsSemiringWithoutAnnihilatingZero _≈_ _+_ _*_ 0# 1#
639
640 open IsSemiringWithoutAnnihilatingZero
641 isSemiringWithoutAnnihilatingZero public
642
643 rawSemiring : RawSemiring c ℓ
644 rawSemiring = record
645 { _≈_ = _≈_
646 ; _+_ = _+_
647 ; _*_ = _*_
648 ; 0# = 0#
649 ; 1# = 1#
650 }
651
652 open RawSemiring rawSemiring public
653 using (rawNearSemiring)
654
655 +-commutativeMonoid : CommutativeMonoid _ _
656 +-commutativeMonoid =
657 record { isCommutativeMonoid = +-isCommutativeMonoid }
658
659 open CommutativeMonoid +-commutativeMonoid public
660 using (_≉_) renaming
661 ( rawMagma to +-rawMagma
662 ; magma to +-magma
663 ; unitalMagma to +-unitalMagma
664 ; commutativeMagma to +-commutativeMagma
665 ; semigroup to +-semigroup
666 ; commutativeSemigroup to +-commutativeSemigroup
667 ; rawMonoid to +-rawMonoid
668 ; monoid to +-monoid
669 )
670
671 *-monoid : Monoid _ _
672 *-monoid = record { isMonoid = *-isMonoid }
673
674 open Monoid *-monoid public
675 using () renaming
676 ( rawMagma to *-rawMagma
677 ; magma to *-magma
678 ; semigroup to *-semigroup
679 ; rawMonoid to *-rawMonoid
680 )
681
682
683 record Semiring c ℓ : Set (suc (c ⊔ ℓ)) where
684 infixl 7 _*_
685 infixl 6 _+_
686 infix 4 _≈_
687 field
688 Carrier : Set c
689 _≈_ : Rel Carrier ℓ
690 _+_ : Op₂ Carrier
691 _*_ : Op₂ Carrier
692 0# : Carrier
693 1# : Carrier
694 isSemiring : IsSemiring _≈_ _+_ _*_ 0# 1#
695
696 open IsSemiring isSemiring public
697
698 semiringWithoutAnnihilatingZero : SemiringWithoutAnnihilatingZero _ _
699 semiringWithoutAnnihilatingZero = record
700 { isSemiringWithoutAnnihilatingZero =
701 isSemiringWithoutAnnihilatingZero
702 }
703
704 open SemiringWithoutAnnihilatingZero
705 semiringWithoutAnnihilatingZero public
706 using
707 ( _≉_; +-rawMagma; +-magma; +-unitalMagma; +-commutativeMagma
708 ; +-semigroup; +-commutativeSemigroup
709 ; *-rawMagma; *-magma; *-semigroup
710 ; +-rawMonoid; +-monoid; +-commutativeMonoid
711 ; *-rawMonoid; *-monoid
712 ; rawNearSemiring ; rawSemiring
713 )
714
715 semiringWithoutOne : SemiringWithoutOne _ _
716 semiringWithoutOne =
717 record { isSemiringWithoutOne = isSemiringWithoutOne }
718
719 open SemiringWithoutOne semiringWithoutOne public
720 using (nearSemiring)
721
722
723 record CommutativeSemiring c ℓ : Set (suc (c ⊔ ℓ)) where
724 infixl 7 _*_
725 infixl 6 _+_
726 infix 4 _≈_
727 field
728 Carrier : Set c
729 _≈_ : Rel Carrier ℓ
730 _+_ : Op₂ Carrier
731 _*_ : Op₂ Carrier
732 0# : Carrier
733 1# : Carrier
734 isCommutativeSemiring : IsCommutativeSemiring _≈_ _+_ _*_ 0# 1#
735
736 open IsCommutativeSemiring isCommutativeSemiring public
737
738 semiring : Semiring _ _
739 semiring = record { isSemiring = isSemiring }
740
741 open Semiring semiring public
742 using
743 ( _≉_; +-rawMagma; +-magma; +-unitalMagma; +-commutativeMagma
744 ; +-semigroup; +-commutativeSemigroup
745 ; *-rawMagma; *-magma; *-semigroup
746 ; +-rawMonoid; +-monoid; +-commutativeMonoid
747 ; *-rawMonoid; *-monoid
748 ; nearSemiring; semiringWithoutOne
749 ; semiringWithoutAnnihilatingZero
750 ; rawSemiring
751 )
752
753 *-commutativeMonoid : CommutativeMonoid _ _
754 *-commutativeMonoid = record
755 { isCommutativeMonoid = *-isCommutativeMonoid
756 }
757
758 open CommutativeMonoid *-commutativeMonoid public
759 using () renaming
760 ( commutativeMagma to *-commutativeMagma
761 ; commutativeSemigroup to *-commutativeSemigroup
762 )
763
764 commutativeSemiringWithoutOne : CommutativeSemiringWithoutOne _ _
765 commutativeSemiringWithoutOne = record
766 { isCommutativeSemiringWithoutOne = isCommutativeSemiringWithoutOne
767 }
768
769
770 record CancellativeCommutativeSemiring c ℓ : Set (suc (c ⊔ ℓ)) where
771 infixl 7 _*_
772 infixl 6 _+_
773 infix 4 _≈_
774 field
775 Carrier : Set c
776 _≈_ : Rel Carrier ℓ
777 _+_ : Op₂ Carrier
778 _*_ : Op₂ Carrier
779 0# : Carrier
780 1# : Carrier
781 isCancellativeCommutativeSemiring : IsCancellativeCommutativeSemiring _≈_ _+_ _*_ 0# 1#
782
783 open IsCancellativeCommutativeSemiring isCancellativeCommutativeSemiring public
784
785 commutativeSemiring : CommutativeSemiring c ℓ
786 commutativeSemiring = record
787 { isCommutativeSemiring = isCommutativeSemiring
788 }
789
790 open CommutativeSemiring commutativeSemiring public
791 using
792 ( +-rawMagma; +-magma; +-unitalMagma; +-commutativeMagma
793 ; +-semigroup; +-commutativeSemigroup
794 ; *-rawMagma; *-magma; *-commutativeMagma; *-semigroup; *-commutativeSemigroup
795 ; +-rawMonoid; +-monoid; +-commutativeMonoid
796 ; *-rawMonoid; *-monoid; *-commutativeMonoid
797 ; nearSemiring; semiringWithoutOne
798 ; semiringWithoutAnnihilatingZero
799 ; rawSemiring
800 ; semiring
801 ; _≉_
802 )
803
804 record IdempotentSemiring c ℓ : Set (suc (c ⊔ ℓ)) where
805 infixl 7 _*_
806 infixl 6 _+_
807 infix 4 _≈_
808 field
809 Carrier : Set c
810 _≈_ : Rel Carrier ℓ
811 _+_ : Op₂ Carrier
812 _*_ : Op₂ Carrier
813 0# : Carrier
814 1# : Carrier
815 isIdempotentSemiring : IsIdempotentSemiring _≈_ _+_ _*_ 0# 1#
816
817 open IsIdempotentSemiring isIdempotentSemiring public
818
819 semiring : Semiring _ _
820 semiring = record { isSemiring = isSemiring }
821
822 open Semiring semiring public
823 using
824 ( _≉_; +-rawMagma; +-magma; +-unitalMagma; +-commutativeMagma
825 ; +-semigroup; +-commutativeSemigroup
826 ; *-rawMagma; *-magma; *-semigroup
827 ; +-rawMonoid; +-monoid; +-commutativeMonoid
828 ; *-rawMonoid; *-monoid
829 ; nearSemiring; semiringWithoutOne
830 ; semiringWithoutAnnihilatingZero
831 ; rawSemiring
832 )
833
834 +-idempotentCommutativeMonoid : IdempotentCommutativeMonoid _ _
835 +-idempotentCommutativeMonoid = record { isIdempotentCommutativeMonoid = +-isIdempotentCommutativeMonoid }
836
837 open IdempotentCommutativeMonoid +-idempotentCommutativeMonoid public
838 using ()
839 renaming ( band to +-band
840 ; commutativeBand to +-commutativeBand
841 ; idempotentMonoid to +-idempotentMonoid
842 )
843
844 record KleeneAlgebra c ℓ : Set (suc (c ⊔ ℓ)) where
845 infix 8 _⋆
846 infixl 7 _*_
847 infixl 6 _+_
848 infix 4 _≈_
849 field
850 Carrier : Set c
851 _≈_ : Rel Carrier ℓ
852 _+_ : Op₂ Carrier
853 _*_ : Op₂ Carrier
854 _⋆ : Op₁ Carrier
855 0# : Carrier
856 1# : Carrier
857 isKleeneAlgebra : IsKleeneAlgebra _≈_ _+_ _*_ _⋆ 0# 1#
858
859 open IsKleeneAlgebra isKleeneAlgebra public
860
861 idempotentSemiring : IdempotentSemiring _ _
862 idempotentSemiring = record { isIdempotentSemiring = isIdempotentSemiring }
863
864 open IdempotentSemiring idempotentSemiring public
865 using
866 ( _≉_; +-rawMagma; +-magma; +-unitalMagma; +-commutativeMagma
867 ; +-semigroup; +-commutativeSemigroup
868 ; *-rawMagma; *-magma; *-semigroup
869 ; +-rawMonoid; +-monoid; +-commutativeMonoid
870 ; *-rawMonoid; *-monoid
871 ; nearSemiring; semiringWithoutOne
872 ; semiringWithoutAnnihilatingZero
873 ; rawSemiring; semiring
874 )
875
876 rawKleeneAlgebra : RawKleeneAlgebra _ _
877 rawKleeneAlgebra = record
878 { _≈_ = _≈_
879 ; _+_ = _+_
880 ; _*_ = _*_
881 ; _⋆ = _⋆
882 ; 0# = 0#
883 ; 1# = 1#
884 }
885
886 record Quasiring c ℓ : Set (suc (c ⊔ ℓ)) where
887 infixl 7 _*_
888 infixl 6 _+_
889 infix 4 _≈_
890 field
891 Carrier : Set c
892 _≈_ : Rel Carrier ℓ
893 _+_ : Op₂ Carrier
894 _*_ : Op₂ Carrier
895 0# : Carrier
896 1# : Carrier
897 isQuasiring : IsQuasiring _≈_ _+_ _*_ 0# 1#
898
899 open IsQuasiring isQuasiring public
900
901 +-monoid : Monoid _ _
902 +-monoid = record { isMonoid = +-isMonoid }
903
904 open Monoid +-monoid public
905 using (_≉_) renaming
906 ( rawMagma to +-rawMagma
907 ; magma to +-magma
908 ; semigroup to +-semigroup
909 ; unitalMagma to +-unitalMagma
910 ; rawMonoid to +-rawMonoid
911 )
912
913 *-monoid : Monoid _ _
914 *-monoid = record { isMonoid = *-isMonoid }
915
916 open Monoid *-monoid public
917 using () renaming
918 ( rawMagma to *-rawMagma
919 ; magma to *-magma
920 ; semigroup to *-semigroup
921 ; rawMonoid to *-rawMonoid
922 )
923
924 ------------------------------------------------------------------------
925 -- Bundles with 2 binary operations, 1 unary operation & 1 element
926 ------------------------------------------------------------------------
927
928 record RingWithoutOne c ℓ : Set (suc (c ⊔ ℓ)) where
929 infix 8 -_
930 infixl 7 _*_
931 infixl 6 _+_
932 infix 4 _≈_
933 field
934 Carrier : Set c
935 _≈_ : Rel Carrier ℓ
936 _+_ : Op₂ Carrier
937 _*_ : Op₂ Carrier
938 -_ : Op₁ Carrier
939 0# : Carrier
940 isRingWithoutOne : IsRingWithoutOne _≈_ _+_ _*_ -_ 0#
941
942 open IsRingWithoutOne isRingWithoutOne public
943
944 nearSemiring : NearSemiring _ _
945 nearSemiring = record { isNearSemiring = isNearSemiring }
946
947 open NearSemiring nearSemiring public
948 using (*-semigroup; *-magma)
949
950 +-abelianGroup : AbelianGroup _ _
951 +-abelianGroup = record { isAbelianGroup = +-isAbelianGroup }
952
953 open AbelianGroup +-abelianGroup public
954 using ()
955 renaming (group to +-group;
956 invertibleMagma to +-invertibleMagma;
957 invertibleUnitalMagma to +-invertibleUnitalMagma)
958
959 rawRingWithoutOne : RawRingWithoutOne _ _
960 rawRingWithoutOne = record
961 { _≈_ = _≈_
962 ; _+_ = _+_
963 ; _*_ = _*_
964 ; -_ = -_
965 ; 0# = 0#
966 }
967
968 open RawRingWithoutOne rawRingWithoutOne public
969 using (+-rawGroup; *-rawMagma; rawNearSemiring)
970
971
972 ------------------------------------------------------------------------
973 -- Bundles with 2 binary operations, 1 unary operation & 2 elements
974 ------------------------------------------------------------------------
975
976 record NonAssociativeRing c ℓ : Set (suc (c ⊔ ℓ)) where
977 infix 8 -_
978 infixl 7 _*_
979 infixl 6 _+_
980 infix 4 _≈_
981 field
982 Carrier : Set c
983 _≈_ : Rel Carrier ℓ
984 _+_ : Op₂ Carrier
985 _*_ : Op₂ Carrier
986 -_ : Op₁ Carrier
987 0# : Carrier
988 1# : Carrier
989 isNonAssociativeRing : IsNonAssociativeRing _≈_ _+_ _*_ -_ 0# 1#
990
991 open IsNonAssociativeRing isNonAssociativeRing public
992
993 +-abelianGroup : AbelianGroup _ _
994 +-abelianGroup = record { isAbelianGroup = +-isAbelianGroup }
995
996 open AbelianGroup +-abelianGroup public
997 using () renaming (group to +-group; invertibleMagma to +-invertibleMagma; invertibleUnitalMagma to +-invertibleUnitalMagma)
998
999 *-unitalMagma : UnitalMagma _ _
1000 *-unitalMagma = record { isUnitalMagma = *-isUnitalMagma}
1001
1002 open UnitalMagma *-unitalMagma public
1003 using () renaming (magma to *-magma; identity to *-identity)
1004
1005 record Nearring c ℓ : Set (suc (c ⊔ ℓ)) where
1006 infix 8 -_
1007 infixl 7 _*_
1008 infixl 6 _+_
1009 infix 4 _≈_
1010 field
1011 Carrier : Set c
1012 _≈_ : Rel Carrier ℓ
1013 _+_ : Op₂ Carrier
1014 _*_ : Op₂ Carrier
1015 -_ : Op₁ Carrier
1016 0# : Carrier
1017 1# : Carrier
1018 isNearring : IsNearring _≈_ _+_ _*_ 0# 1# -_
1019
1020 open IsNearring isNearring public
1021
1022 quasiring : Quasiring _ _
1023 quasiring = record { isQuasiring = isQuasiring }
1024
1025 open Quasiring quasiring public
1026 using
1027 (_≉_; +-rawMagma; +-magma; +-unitalMagma; +-semigroup; +-monoid; +-rawMonoid
1028 ;*-rawMagma; *-magma; *-semigroup; *-monoid
1029 )
1030
1031
1032 record Ring c ℓ : Set (suc (c ⊔ ℓ)) where
1033 infix 8 -_
1034 infixl 7 _*_
1035 infixl 6 _+_
1036 infix 4 _≈_
1037 field
1038 Carrier : Set c
1039 _≈_ : Rel Carrier ℓ
1040 _+_ : Op₂ Carrier
1041 _*_ : Op₂ Carrier
1042 -_ : Op₁ Carrier
1043 0# : Carrier
1044 1# : Carrier
1045 isRing : IsRing _≈_ _+_ _*_ -_ 0# 1#
1046
1047 open IsRing isRing public
1048
1049 +-abelianGroup : AbelianGroup _ _
1050 +-abelianGroup = record { isAbelianGroup = +-isAbelianGroup }
1051
1052 ringWithoutOne : RingWithoutOne _ _
1053 ringWithoutOne = record { isRingWithoutOne = isRingWithoutOne }
1054
1055 semiring : Semiring _ _
1056 semiring = record { isSemiring = isSemiring }
1057
1058 open Semiring semiring public
1059 using
1060 ( _≉_; +-rawMagma; +-magma; +-unitalMagma; +-commutativeMagma
1061 ; +-semigroup; +-commutativeSemigroup
1062 ; *-rawMagma; *-magma; *-semigroup
1063 ; +-rawMonoid; +-monoid ; +-commutativeMonoid
1064 ; *-rawMonoid; *-monoid
1065 ; nearSemiring; semiringWithoutOne
1066 ; semiringWithoutAnnihilatingZero
1067 )
1068
1069 open NearSemiring nearSemiring public
1070 using (rawNearSemiring)
1071
1072 open AbelianGroup +-abelianGroup public
1073 using () renaming (group to +-group; invertibleMagma to +-invertibleMagma; invertibleUnitalMagma to +-invertibleUnitalMagma)
1074
1075 rawRing : RawRing _ _
1076 rawRing = record
1077 { _≈_ = _≈_
1078 ; _+_ = _+_
1079 ; _*_ = _*_
1080 ; -_ = -_
1081 ; 0# = 0#
1082 ; 1# = 1#
1083 }
1084
1085 open RawRing rawRing public
1086 using (rawRingWithoutOne; +-rawGroup)
1087
1088
1089 record CommutativeRing c ℓ : Set (suc (c ⊔ ℓ)) where
1090 infix 8 -_
1091 infixl 7 _*_
1092 infixl 6 _+_
1093 infix 4 _≈_
1094 field
1095 Carrier : Set c
1096 _≈_ : Rel Carrier ℓ
1097 _+_ : Op₂ Carrier
1098 _*_ : Op₂ Carrier
1099 -_ : Op₁ Carrier
1100 0# : Carrier
1101 1# : Carrier
1102 isCommutativeRing : IsCommutativeRing _≈_ _+_ _*_ -_ 0# 1#
1103
1104 open IsCommutativeRing isCommutativeRing public
1105
1106 ring : Ring _ _
1107 ring = record { isRing = isRing }
1108
1109 open Ring ring public using (_≉_; rawRing; +-invertibleMagma; +-invertibleUnitalMagma; +-group; +-abelianGroup)
1110
1111 commutativeSemiring : CommutativeSemiring _ _
1112 commutativeSemiring =
1113 record { isCommutativeSemiring = isCommutativeSemiring }
1114
1115 open CommutativeSemiring commutativeSemiring public
1116 using
1117 ( +-rawMagma; +-magma; +-unitalMagma; +-commutativeMagma
1118 ; +-semigroup; +-commutativeSemigroup
1119 ; *-rawMagma; *-magma; *-commutativeMagma; *-semigroup; *-commutativeSemigroup
1120 ; +-rawMonoid; +-monoid; +-commutativeMonoid
1121 ; *-rawMonoid; *-monoid; *-commutativeMonoid
1122 ; nearSemiring; semiringWithoutOne
1123 ; semiringWithoutAnnihilatingZero; semiring
1124 ; commutativeSemiringWithoutOne
1125 )
1126
1127 ------------------------------------------------------------------------
1128 -- Bundles with 3 binary operations
1129 ------------------------------------------------------------------------
1130
1131 record Quasigroup c ℓ : Set (suc (c ⊔ ℓ)) where
1132 infixl 7 _∙_
1133 infixl 7 _\\_
1134 infixl 7 _//_
1135 infix 4 _≈_
1136 field
1137 Carrier : Set c
1138 _≈_ : Rel Carrier ℓ
1139 _∙_ : Op₂ Carrier
1140 _\\_ : Op₂ Carrier
1141 _//_ : Op₂ Carrier
1142 isQuasigroup : IsQuasigroup _≈_ _∙_ _\\_ _//_
1143
1144 open IsQuasigroup isQuasigroup public
1145
1146 magma : Magma c ℓ
1147 magma = record { isMagma = isMagma }
1148
1149 open Magma magma public
1150 using (_≉_; rawMagma)
1151
1152 rawQuasigroup : RawQuasigroup c ℓ
1153 rawQuasigroup = record
1154 { _≈_ = _≈_
1155 ; _∙_ = _∙_
1156 ; _\\_ = _\\_
1157 ; _//_ = _//_
1158 }
1159
1160 open RawQuasigroup rawQuasigroup public
1161 using (//-rawMagma; \\-rawMagma; ∙-rawMagma)
1162
1163 record Loop c ℓ : Set (suc (c ⊔ ℓ)) where
1164 infixl 7 _∙_
1165 infixl 7 _\\_
1166 infixl 7 _//_
1167 infix 4 _≈_
1168 field
1169 Carrier : Set c
1170 _≈_ : Rel Carrier ℓ
1171 _∙_ : Op₂ Carrier
1172 _\\_ : Op₂ Carrier
1173 _//_ : Op₂ Carrier
1174 ε : Carrier
1175 isLoop : IsLoop _≈_ _∙_ _\\_ _//_ ε
1176
1177 open IsLoop isLoop public
1178
1179 rawLoop : RawLoop c ℓ
1180 rawLoop = record
1181 { _≈_ = _≈_
1182 ; _∙_ = _∙_
1183 ; _\\_ = _\\_
1184 ; _//_ = _//_
1185 ; ε = ε
1186 }
1187
1188 quasigroup : Quasigroup _ _
1189 quasigroup = record { isQuasigroup = isQuasigroup }
1190
1191 open Quasigroup quasigroup public
1192 using (_≉_; ∙-rawMagma; \\-rawMagma; //-rawMagma)
1193
1194 record LeftBolLoop c ℓ : Set (suc (c ⊔ ℓ)) where
1195 infixl 7 _∙_
1196 infixl 7 _\\_
1197 infixl 7 _//_
1198 infix 4 _≈_
1199 field
1200 Carrier : Set c
1201 _≈_ : Rel Carrier ℓ
1202 _∙_ : Op₂ Carrier
1203 _\\_ : Op₂ Carrier
1204 _//_ : Op₂ Carrier
1205 ε : Carrier
1206 isLeftBolLoop : IsLeftBolLoop _≈_ _∙_ _\\_ _//_ ε
1207
1208 open IsLeftBolLoop isLeftBolLoop public
1209
1210 loop : Loop _ _
1211 loop = record { isLoop = isLoop }
1212
1213 open Loop loop public
1214 using (quasigroup)
1215
1216 record RightBolLoop c ℓ : Set (suc (c ⊔ ℓ)) where
1217 infixl 7 _∙_
1218 infixl 7 _\\_
1219 infixl 7 _//_
1220 infix 4 _≈_
1221 field
1222 Carrier : Set c
1223 _≈_ : Rel Carrier ℓ
1224 _∙_ : Op₂ Carrier
1225 _\\_ : Op₂ Carrier
1226 _//_ : Op₂ Carrier
1227 ε : Carrier
1228 isRightBolLoop : IsRightBolLoop _≈_ _∙_ _\\_ _//_ ε
1229
1230 open IsRightBolLoop isRightBolLoop public
1231
1232 loop : Loop _ _
1233 loop = record { isLoop = isLoop }
1234
1235 open Loop loop public
1236 using (quasigroup)
1237
1238 record MoufangLoop c ℓ : Set (suc (c ⊔ ℓ)) where
1239 infixl 7 _∙_
1240 infixl 7 _\\_
1241 infixl 7 _//_
1242 infix 4 _≈_
1243 field
1244 Carrier : Set c
1245 _≈_ : Rel Carrier ℓ
1246 _∙_ : Op₂ Carrier
1247 _\\_ : Op₂ Carrier
1248 _//_ : Op₂ Carrier
1249 ε : Carrier
1250 isMoufangLoop : IsMoufangLoop _≈_ _∙_ _\\_ _//_ ε
1251
1252 open IsMoufangLoop isMoufangLoop public
1253
1254 leftBolLoop : LeftBolLoop _ _
1255 leftBolLoop = record { isLeftBolLoop = isLeftBolLoop }
1256
1257 open LeftBolLoop leftBolLoop public
1258 using (loop)
1259
1260 record MiddleBolLoop c ℓ : Set (suc (c ⊔ ℓ)) where
1261 infixl 7 _∙_
1262 infixl 7 _\\_
1263 infixl 7 _//_
1264 infix 4 _≈_
1265 field
1266 Carrier : Set c
1267 _≈_ : Rel Carrier ℓ
1268 _∙_ : Op₂ Carrier
1269 _\\_ : Op₂ Carrier
1270 _//_ : Op₂ Carrier
1271 ε : Carrier
1272 isMiddleBolLoop : IsMiddleBolLoop _≈_ _∙_ _\\_ _//_ ε
1273
1274 open IsMiddleBolLoop isMiddleBolLoop public
1275
1276 loop : Loop _ _
1277 loop = record { isLoop = isLoop }
1278
1279 open Loop loop public
1280 using (quasigroup)
1281