Skip to content

Commit 578e7a6

Browse files
authored
Move raw bundles from Data.X.Properties to Data.X.Base (#1810)
1 parent 14a63da commit 578e7a6

File tree

14 files changed

+586
-455
lines changed

14 files changed

+586
-455
lines changed

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,32 @@ Major improvements
671671
* Beneficieries of this change include `Data.Rational.Unnormalised.Base` whose
672672
dependencies are now significantly smaller.
673673
674+
### Moved raw bundles from Data.X.Properties to Data.X.Base
675+
676+
* As mentioned by MatthewDaggitt in Issue #1755, Raw bundles defined in Data.X.Properties
677+
should be defined in Data.X.Base as they don't require any properties.
678+
* Moved raw bundles From `Data.Nat.Properties` to `Data.Nat.Base`
679+
* Moved raw bundles From `Data.Nat.Binary.Properties` to `Data.Nat.Binary.Base`
680+
* Moved raw bundles From `Data.Rational.Properties` to `Data.Rational.Base`
681+
* Moved raw bundles From `Data.Rational.Unnormalised.Properties` to `Data.Rational.Unnormalised.Base`
682+
683+
### Moved the definition of RawX from `Algebra.X.Bundles` to `Algebra.X.Bundles.Raw`
684+
685+
* A new module `Algebra.Bundles.Raw` containing the definitions of the raw bundles
686+
can be imported at much lower cost from `Data.X.Base`.
687+
The following definitions have been moved:
688+
* `RawMagma`
689+
* `RawMonoid`
690+
* `RawGroup`
691+
* `RawNearSemiring`
692+
* `RawSemiring`
693+
* `RawRingWithoutOne`
694+
* `RawRing`
695+
* `RawQuasigroup`
696+
* `RawLoop`
697+
* A new module `Algebra.Lattice.Bundles.Raw` is also introduced.
698+
* `RawLattice` has been moved from `Algebra.Lattice.Bundles` to this new module.
699+
674700
Deprecated modules
675701
------------------
676702

README/Design/Hierarchies.agda

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ private
4242
-- all four of which are publicly re-exported by `X` itself.
4343
--
4444
-- Additionally a hierarchy `X` may contain additional files
45+
-- ∙ X.Bundles.Raw
4546
-- ∙ X.Consequences
4647
-- ∙ X.Constructs
4748
-- ∙ X.Properties
@@ -252,6 +253,33 @@ record Semigroup : Set (suc (a ⊔ ℓ)) where
252253
-- Other hierarchy modules
253254
------------------------------------------------------------------------
254255

256+
------------------------------------------------------------------------
257+
-- X.Bundles.Raw
258+
259+
-- Sometimes it is useful to have the bundles without any accompanying
260+
-- laws. These correspond more or less to what the definitions would
261+
-- be in non-dependently typed languages like Haskell.
262+
263+
-- Each bundle thereofre has a corresponding raw bundle that only
264+
-- include the laws but not the operations.
265+
266+
record RawMagma c ℓ : Set (suc (c ⊔ ℓ)) where
267+
infixl 7 _∙_
268+
infix 4 _≈_
269+
field
270+
Carrier : Set c
271+
_≈_ : Rel Carrier ℓ
272+
_∙_ : Op₂ Carrier
273+
274+
record RawMonoid 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+
255283
------------------------------------------------------------------------
256284
-- X.Consequences
257285

src/Algebra/Bundles.agda

Lines changed: 10 additions & 243 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
module Algebra.Bundles where
1313

14+
import Algebra.Bundles.Raw as Raw
1415
open import Algebra.Core
1516
open import Algebra.Structures
1617
open import Relation.Binary
@@ -19,21 +20,17 @@ import Relation.Nullary as N
1920
open import Level
2021

2122
------------------------------------------------------------------------
22-
-- Bundles with 1 binary operation
23-
------------------------------------------------------------------------
24-
25-
record RawMagma c ℓ : Set (suc (c ⊔ ℓ)) where
26-
infixl 7 _∙_
27-
infix 4 _≈_
28-
field
29-
Carrier : Set c
30-
_≈_ : Rel Carrier ℓ
31-
_∙_ : Op₂ Carrier
23+
-- Re-export definitions of 'raw' bundles
3224

33-
infix 4 _≉_
34-
_≉_ : Rel Carrier _
35-
x ≉ y = N.¬ (x ≈ y)
25+
open Raw public
26+
using (RawMagma; RawMonoid; RawGroup
27+
; RawNearSemiring; RawSemiring
28+
; RawRingWithoutOne; RawRing
29+
; RawQuasigroup; RawLoop)
3630

31+
------------------------------------------------------------------------
32+
-- Bundles with 1 binary operation
33+
------------------------------------------------------------------------
3734

3835
record Magma c ℓ : Set (suc (c ⊔ ℓ)) where
3936
infixl 7 _∙_
@@ -232,27 +229,6 @@ record CommutativeSemigroup c ℓ : Set (suc (c ⊔ ℓ)) where
232229
-- Bundles with 1 binary operation & 1 element
233230
------------------------------------------------------------------------
234231

235-
-- A raw monoid is a monoid without any laws.
236-
237-
record RawMonoid c ℓ : Set (suc (c ⊔ ℓ)) where
238-
infixl 7 _∙_
239-
infix 4 _≈_
240-
field
241-
Carrier : Set c
242-
_≈_ : Rel Carrier ℓ
243-
_∙_ : Op₂ Carrier
244-
ε : Carrier
245-
246-
rawMagma : RawMagma c ℓ
247-
rawMagma = record
248-
{ _≈_ = _≈_
249-
; _∙_ = _∙_
250-
}
251-
252-
open RawMagma rawMagma public
253-
using (_≉_)
254-
255-
256232
record UnitalMagma c ℓ : Set (suc (c ⊔ ℓ)) where
257233
infixl 7 _∙_
258234
infix 4 _≈_
@@ -359,28 +335,6 @@ module BoundedLattice {c ℓ} (idemCommMonoid : IdempotentCommutativeMonoid c
359335
-- Bundles with 1 binary operation, 1 unary operation & 1 element
360336
------------------------------------------------------------------------
361337

362-
record RawGroup c ℓ : Set (suc (c ⊔ ℓ)) where
363-
infix 8 _⁻¹
364-
infixl 7 _∙_
365-
infix 4 _≈_
366-
field
367-
Carrier : Set c
368-
_≈_ : Rel Carrier ℓ
369-
_∙_ : Op₂ Carrier
370-
ε : Carrier
371-
_⁻¹ : Op₁ Carrier
372-
373-
rawMonoid : RawMonoid c ℓ
374-
rawMonoid = record
375-
{ _≈_ = _≈_
376-
; _∙_ = _∙_
377-
; ε = ε
378-
}
379-
380-
open RawMonoid rawMonoid public
381-
using (_≉_; rawMagma)
382-
383-
384338
record InvertibleMagma c ℓ : Set (suc (c ⊔ ℓ)) where
385339
infix 8 _⁻¹
386340
infixl 7 _∙_
@@ -487,34 +441,6 @@ record AbelianGroup c ℓ : Set (suc (c ⊔ ℓ)) where
487441
-- Bundles with 2 binary operations & 1 element
488442
------------------------------------------------------------------------
489443

490-
record RawNearSemiring c ℓ : Set (suc (c ⊔ ℓ)) where
491-
infixl 7 _*_
492-
infixl 6 _+_
493-
infix 4 _≈_
494-
field
495-
Carrier : Set c
496-
_≈_ : Rel Carrier ℓ
497-
_+_ : Op₂ Carrier
498-
_*_ : Op₂ Carrier
499-
0# : Carrier
500-
501-
+-rawMonoid : RawMonoid c ℓ
502-
+-rawMonoid = record
503-
{ _≈_ = _≈_
504-
; _∙_ = _+_
505-
; ε = 0#
506-
}
507-
508-
open RawMonoid +-rawMonoid public
509-
using (_≉_) renaming (rawMagma to +-rawMagma)
510-
511-
*-rawMagma : RawMagma c ℓ
512-
*-rawMagma = record
513-
{ _≈_ = _≈_
514-
; _∙_ = _*_
515-
}
516-
517-
518444
record NearSemiring c ℓ : Set (suc (c ⊔ ℓ)) where
519445
infixl 7 _*_
520446
infixl 6 _+_
@@ -626,37 +552,6 @@ record CommutativeSemiringWithoutOne c ℓ : Set (suc (c ⊔ ℓ)) where
626552
-- Bundles with 2 binary operations & 2 elements
627553
------------------------------------------------------------------------
628554

629-
record RawSemiring c ℓ : Set (suc (c ⊔ ℓ)) where
630-
infixl 7 _*_
631-
infixl 6 _+_
632-
infix 4 _≈_
633-
field
634-
Carrier : Set c
635-
_≈_ : Rel Carrier ℓ
636-
_+_ : Op₂ Carrier
637-
_*_ : Op₂ Carrier
638-
0# : Carrier
639-
1# : Carrier
640-
641-
rawNearSemiring : RawNearSemiring c ℓ
642-
rawNearSemiring = record
643-
{ _≈_ = _≈_
644-
; _+_ = _+_
645-
; _*_ = _*_
646-
; 0# = 0#
647-
}
648-
649-
open RawNearSemiring rawNearSemiring public
650-
using (_≉_; +-rawMonoid; +-rawMagma; *-rawMagma)
651-
652-
*-rawMonoid : RawMonoid c ℓ
653-
*-rawMonoid = record
654-
{ _≈_ = _≈_
655-
; _∙_ = _*_
656-
; ε = 1#
657-
}
658-
659-
660555
record SemiringWithoutAnnihilatingZero c ℓ : Set (suc (c ⊔ ℓ)) where
661556
infixl 7 _*_
662557
infixl 6 _+_
@@ -939,37 +834,6 @@ record Quasiring c ℓ : Set (suc (c ⊔ ℓ)) where
939834
-- Bundles with 2 binary operations, 1 unary operation & 1 element
940835
------------------------------------------------------------------------
941836

942-
record RawRingWithoutOne c ℓ : Set (suc (c ⊔ ℓ)) where
943-
infix 8 -_
944-
infixl 7 _*_
945-
infixl 6 _+_
946-
infix 4 _≈_
947-
field
948-
Carrier : Set c
949-
_≈_ : Rel Carrier ℓ
950-
_+_ : Op₂ Carrier
951-
_*_ : Op₂ Carrier
952-
-_ : Op₁ Carrier
953-
0# : Carrier
954-
955-
+-rawGroup : RawGroup c ℓ
956-
+-rawGroup = record
957-
{ _≈_ = _≈_
958-
; _∙_ = _+_
959-
; ε = 0#
960-
; _⁻¹ = -_
961-
}
962-
963-
open RawGroup +-rawGroup public
964-
using (_≉_) renaming (rawMagma to +-rawMagma; rawMonoid to +-rawMonoid)
965-
966-
*-rawMagma : RawMagma c ℓ
967-
*-rawMagma = record
968-
{ _≈_ = _≈_
969-
; _∙_ = _*_
970-
}
971-
972-
973837
record RingWithoutOne c ℓ : Set (suc (c ⊔ ℓ)) where
974838
infix 8 -_
975839
infixl 7 _*_
@@ -1053,46 +917,6 @@ record Nearring c ℓ : Set (suc (c ⊔ ℓ)) where
1053917
;*-rawMagma; *-magma; *-semigroup; *-monoid
1054918
)
1055919

1056-
-- A raw ring is a ring without any laws.
1057-
1058-
record RawRing c ℓ : Set (suc (c ⊔ ℓ)) where
1059-
infix 8 -_
1060-
infixl 7 _*_
1061-
infixl 6 _+_
1062-
infix 4 _≈_
1063-
field
1064-
Carrier : Set c
1065-
_≈_ : Rel Carrier ℓ
1066-
_+_ : Op₂ Carrier
1067-
_*_ : Op₂ Carrier
1068-
-_ : Op₁ Carrier
1069-
0# : Carrier
1070-
1# : Carrier
1071-
1072-
rawSemiring : RawSemiring c ℓ
1073-
rawSemiring = record
1074-
{ _≈_ = _≈_
1075-
; _+_ = _+_
1076-
; _*_ = _*_
1077-
; 0# = 0#
1078-
; 1# = 1#
1079-
}
1080-
1081-
open RawSemiring rawSemiring public
1082-
using
1083-
( _≉_
1084-
; +-rawMagma; +-rawMonoid
1085-
; *-rawMagma; *-rawMonoid
1086-
)
1087-
1088-
+-rawGroup : RawGroup c ℓ
1089-
+-rawGroup = record
1090-
{ _≈_ = _≈_
1091-
; _∙_ = _+_
1092-
; ε = 0#
1093-
; _⁻¹ = -_
1094-
}
1095-
1096920

1097921
record Ring c ℓ : Set (suc (c ⊔ ℓ)) where
1098922
infix 8 -_
@@ -1184,39 +1008,6 @@ record CommutativeRing c ℓ : Set (suc (c ⊔ ℓ)) where
11841008
-- Bundles with 3 binary operations
11851009
------------------------------------------------------------------------
11861010

1187-
record RawQuasigroup c ℓ : Set (suc (c ⊔ ℓ)) where
1188-
infixl 7 _∙_
1189-
infixl 7 _\\_
1190-
infixl 7 _//_
1191-
infix 4 _≈_
1192-
field
1193-
Carrier : Set c
1194-
_≈_ : Rel Carrier ℓ
1195-
_∙_ : Op₂ Carrier
1196-
_\\_ : Op₂ Carrier
1197-
_//_ : Op₂ Carrier
1198-
1199-
∙-rawMagma : RawMagma c ℓ
1200-
∙-rawMagma = record
1201-
{ _≈_ = _≈_
1202-
; _∙_ = _∙_
1203-
}
1204-
1205-
\\-rawMagma : RawMagma c ℓ
1206-
\\-rawMagma = record
1207-
{ _≈_ = _≈_
1208-
; _∙_ = _\\_
1209-
}
1210-
1211-
//-rawMagma : RawMagma c ℓ
1212-
//-rawMagma = record
1213-
{ _≈_ = _≈_
1214-
; _∙_ = _//_
1215-
}
1216-
1217-
open RawMagma \\-rawMagma public
1218-
using (_≉_)
1219-
12201011
record Quasigroup c ℓ : Set (suc (c ⊔ ℓ)) where
12211012
infixl 7 _∙_
12221013
infixl 7 _\\_
@@ -1249,30 +1040,6 @@ record Quasigroup c ℓ : Set (suc (c ⊔ ℓ)) where
12491040
open RawQuasigroup rawQuasigroup public
12501041
using (//-rawMagma; \\-rawMagma; ∙-rawMagma)
12511042

1252-
record RawLoop c ℓ : Set (suc (c ⊔ ℓ)) where
1253-
infixl 7 _∙_
1254-
infixl 7 _\\_
1255-
infixl 7 _//_
1256-
infix 4 _≈_
1257-
field
1258-
Carrier : Set c
1259-
_≈_ : Rel Carrier ℓ
1260-
_∙_ : Op₂ Carrier
1261-
_\\_ : Op₂ Carrier
1262-
_//_ : Op₂ Carrier
1263-
ε : Carrier
1264-
1265-
rawQuasigroup : RawQuasigroup c ℓ
1266-
rawQuasigroup = record
1267-
{ _≈_ = _≈_
1268-
; _∙_ = _∙_
1269-
; _\\_ = _\\_
1270-
; _//_ = _//_
1271-
}
1272-
1273-
open RawQuasigroup rawQuasigroup public
1274-
using (_≉_ ; ∙-rawMagma; \\-rawMagma; //-rawMagma)
1275-
12761043
record Loop c ℓ : Set (suc (c ⊔ ℓ)) where
12771044
infixl 7 _∙_
12781045
infixl 7 _\\_

0 commit comments

Comments
 (0)