Skip to content

Commit fd903e3

Browse files
jamesmckinnaandreasabel
authored andcommittedJul 10, 2024
Add IsIdempotentMonoid and IsCommutativeBand to Algebra.Structures (#2402)
* fix #2138 * fixed `Structures`; added `Bundles` * added fields; plus redefined `IsSemilattice` and `IsBoundedSemilattice` as aliases * `fix-whitespace` * reexported `comm` * fixed `Lattice.Bundles` * knock-on * added text about redefinition of `Is(Bounded)Semilattice` * add manifest fields to `IsIdempotentSemiring` * final missing `Bundles` * `CHANGELOG`
1 parent e89fa26 commit fd903e3

File tree

6 files changed

+137
-15
lines changed

6 files changed

+137
-15
lines changed
 

‎CHANGELOG.md

+21
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ Minor improvements
4545
`Data.Product.Relation.Binary.Pointwise.NonDependent.Pointwise`
4646
has been generalised to take heterogeneous arguments in `REL`.
4747

48+
* The structures `IsSemilattice` and `IsBoundedSemilattice` in
49+
`Algebra.Lattice.Structures` have been redefined as aliases of
50+
`IsCommutativeBand` and `IsIdempotentMonoid` in `Algebra.Structures`.
51+
52+
4853
Deprecated modules
4954
------------------
5055

@@ -244,8 +249,16 @@ Additions to existing modules
244249
* In `Algebra.Bundles`
245250
```agda
246251
record SuccessorSet c ℓ : Set (suc (c ⊔ ℓ))
252+
record CommutativeBand c ℓ : Set (suc (c ⊔ ℓ))
253+
record IdempotentMonoid c ℓ : Set (suc (c ⊔ ℓ))
254+
```
255+
and additional manifest fields for sub-bundles arising from these in:
256+
```agda
257+
IdempotentCommutativeMonoid
258+
IdempotentSemiring
247259
```
248260

261+
249262
* In `Algebra.Bundles.Raw`
250263
```agda
251264
record RawSuccessorSet c ℓ : Set (suc (c ⊔ ℓ))
@@ -364,6 +377,14 @@ Additions to existing modules
364377
* In `Algebra.Structures`
365378
```agda
366379
record IsSuccessorSet (suc# : Op₁ A) (zero# : A) : Set _
380+
record IsCommutativeBand (∙ : Op₂ A) : Set _
381+
record IsIdempotentMonoid (∙ : Op₂ A) (ε : A) : Set _
382+
```
383+
and additional manifest fields for substructures arising from these in:
384+
```agda
385+
IsIdempotentCommutativeMonoid
386+
IsIdempotentSemiring
387+
```
367388

368389
* In `Algebra.Structures.IsGroup`:
369390
```agda

‎src/Algebra/Bundles.agda

+63
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,30 @@ record CommutativeSemigroup c ℓ : Set (suc (c ⊔ ℓ)) where
243243
commutativeMagma : CommutativeMagma c ℓ
244244
commutativeMagma = record { isCommutativeMagma = isCommutativeMagma }
245245

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+
246270
------------------------------------------------------------------------
247271
-- Bundles with 1 binary operation & 1 element
248272
------------------------------------------------------------------------
@@ -315,6 +339,27 @@ record CommutativeMonoid c ℓ : Set (suc (c ⊔ ℓ)) where
315339
open CommutativeSemigroup commutativeSemigroup public
316340
using (commutativeMagma)
317341

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+
318363

319364
record IdempotentCommutativeMonoid c ℓ : Set (suc (c ⊔ ℓ)) where
320365
infixl 7 _∙_
@@ -331,13 +376,21 @@ record IdempotentCommutativeMonoid c ℓ : Set (suc (c ⊔ ℓ)) where
331376
commutativeMonoid : CommutativeMonoid _ _
332377
commutativeMonoid = record { isCommutativeMonoid = isCommutativeMonoid }
333378

379+
idempotentMonoid : IdempotentMonoid _ _
380+
idempotentMonoid = record { isIdempotentMonoid = isIdempotentMonoid }
381+
382+
commutativeBand : CommutativeBand _ _
383+
commutativeBand = record { isCommutativeBand = isCommutativeBand }
384+
334385
open CommutativeMonoid commutativeMonoid public
335386
using
336387
( _≉_; rawMagma; magma; unitalMagma; commutativeMagma
337388
; semigroup; commutativeSemigroup
338389
; rawMonoid; monoid
339390
)
340391

392+
open CommutativeBand commutativeBand public
393+
using (band)
341394

342395
-- Idempotent commutative monoids are also known as bounded lattices.
343396
-- Note that the BoundedLattice necessarily uses the notation inherited
@@ -778,6 +831,16 @@ record IdempotentSemiring c ℓ : Set (suc (c ⊔ ℓ)) where
778831
; rawSemiring
779832
)
780833

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+
781844
record KleeneAlgebra c ℓ : Set (suc (c ⊔ ℓ)) where
782845
infix 8 _⋆
783846
infixl 7 _*_

‎src/Algebra/Lattice/Bundles.agda

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ record Semilattice c ℓ : Set (suc (c ⊔ ℓ)) where
4343
_∙_ : Op₂ Carrier
4444
isSemilattice : IsSemilattice _≈_ _∙_
4545

46-
open IsSemilattice isSemilattice public
46+
open IsSemilattice _≈_ isSemilattice public
4747

4848
band : Band c ℓ
4949
band = record { isBand = isBand }

‎src/Algebra/Lattice/Construct/Subst/Equality.agda

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ isSemilattice : IsSemilattice ≈₁ ∧ → IsSemilattice ≈₂ ∧
3535
isSemilattice S = record
3636
{ isBand = isBand S.isBand
3737
; comm = comm S.comm
38-
} where module S = IsSemilattice S
38+
} where module S = IsSemilattice ≈₁ S
3939

4040
isLattice : IsLattice ≈₁ ∨ ∧ IsLattice ≈₂ ∨ ∧
4141
isLattice {∨} {∧} S = record

‎src/Algebra/Lattice/Structures.agda

+5-11
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@ open import Algebra.Structures _≈_
3131
------------------------------------------------------------------------
3232
-- Structures with 1 binary operation
3333

34-
record IsSemilattice (∙ : Op₂ A) : Set (a ⊔ ℓ) where
35-
field
36-
isBand : IsBand ∙
37-
comm : Commutative ∙
38-
34+
IsSemilattice = IsCommutativeBand
35+
module IsSemilattice {∙} (L : IsSemilattice ∙) where
36+
open IsCommutativeBand L public
37+
using (isBand; comm)
3938
open IsBand isBand public
4039

4140
-- Used to bring names appropriate for a meet semilattice into scope.
@@ -67,12 +66,7 @@ IsBoundedSemilattice = IsIdempotentCommutativeMonoid
6766
module IsBoundedSemilattice {∙ ε} (L : IsBoundedSemilattice ∙ ε) where
6867

6968
open IsIdempotentCommutativeMonoid L public
70-
71-
isSemilattice : IsSemilattice ∙
72-
isSemilattice = record
73-
{ isBand = isBand
74-
; comm = comm
75-
}
69+
renaming (isCommutativeBand to isSemilattice)
7670

7771

7872
-- Used to bring names appropriate for a bounded meet semilattice

‎src/Algebra/Structures.agda

+46-2
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,20 @@ record IsCommutativeSemigroup (∙ : Op₂ A) : Set (a ⊔ ℓ) where
153153
; comm = comm
154154
}
155155

156+
157+
record IsCommutativeBand (∙ : Op₂ A) : Set (a ⊔ ℓ) where
158+
field
159+
isBand : IsBand ∙
160+
comm : Commutative ∙
161+
162+
open IsBand isBand public
163+
164+
isCommutativeSemigroup : IsCommutativeSemigroup ∙
165+
isCommutativeSemigroup = record { isSemigroup = isSemigroup ; comm = comm }
166+
167+
open IsCommutativeSemigroup isCommutativeSemigroup public
168+
using (isCommutativeMagma)
169+
156170
------------------------------------------------------------------------
157171
-- Structures with 1 binary operation & 1 element
158172
------------------------------------------------------------------------
@@ -208,6 +222,17 @@ record IsCommutativeMonoid (∙ : Op₂ A) (ε : A) : Set (a ⊔ ℓ) where
208222
using (isCommutativeMagma)
209223

210224

225+
record IsIdempotentMonoid (∙ : Op₂ A) (ε : A) : Set (a ⊔ ℓ) where
226+
field
227+
isMonoid : IsMonoid ∙ ε
228+
idem : Idempotent ∙
229+
230+
open IsMonoid isMonoid public
231+
232+
isBand : IsBand ∙
233+
isBand = record { isSemigroup = isSemigroup ; idem = idem }
234+
235+
211236
record IsIdempotentCommutativeMonoid (∙ : Op₂ A)
212237
: A) : Set (a ⊔ ℓ) where
213238
field
@@ -216,9 +241,14 @@ record IsIdempotentCommutativeMonoid (∙ : Op₂ A)
216241

217242
open IsCommutativeMonoid isCommutativeMonoid public
218243

219-
isBand : IsBand ∙
220-
isBand = record { isSemigroup = isSemigroup ; idem = idem }
244+
isIdempotentMonoid : IsIdempotentMonoid ∙ ε
245+
isIdempotentMonoid = record { isMonoid = isMonoid ; idem = idem }
221246

247+
open IsIdempotentMonoid isIdempotentMonoid public
248+
using (isBand)
249+
250+
isCommutativeBand : IsCommutativeBand ∙
251+
isCommutativeBand = record { isBand = isBand ; comm = comm }
222252

223253
------------------------------------------------------------------------
224254
-- Structures with 1 binary operation, 1 unary operation & 1 element
@@ -584,6 +614,20 @@ record IsIdempotentSemiring (+ * : Op₂ A) (0# 1# : A) : Set (a ⊔ ℓ) where
584614

585615
open IsSemiring isSemiring public
586616

617+
+-isIdempotentCommutativeMonoid : IsIdempotentCommutativeMonoid + 0#
618+
+-isIdempotentCommutativeMonoid = record
619+
{ isCommutativeMonoid = +-isCommutativeMonoid
620+
; idem = +-idem
621+
}
622+
623+
open IsIdempotentCommutativeMonoid +-isIdempotentCommutativeMonoid public
624+
using ()
625+
renaming ( isCommutativeBand to +-isCommutativeBand
626+
; isBand to +-isBand
627+
; isIdempotentMonoid to +-isIdempotentMonoid
628+
)
629+
630+
587631
record IsKleeneAlgebra (+ * : Op₂ A) (⋆ : Op₁ A) (0# 1# : A) : Set (a ⊔ ℓ) where
588632
field
589633
isIdempotentSemiring : IsIdempotentSemiring + * 0# 1#

0 commit comments

Comments
 (0)
Please sign in to comment.