Skip to content

Commit 77c31ff

Browse files
Fixed precedence of _≉_ and re-exported it via algebraic bundles (#1329)
1 parent 3273278 commit 77c31ff

File tree

3 files changed

+44
-21
lines changed

3 files changed

+44
-21
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ Bug-fixes
1414
* Fixed the type of the proof `map-id` in `List.Relation.Unary.All.Properties`, which was incorrectly abstracted over
1515
unused module parameters.
1616

17+
* The binary relation `_≉_` exposed by records in `Relation.Binary.Bundles` now has
18+
the correct infix precedence.
19+
1720
Non-backwards compatible changes
1821
--------------------------------
1922

@@ -53,6 +56,8 @@ Other major changes
5356
Other minor additions
5457
---------------------
5558

59+
* All bundles in `Algebra.Bundles` now re-export the binary relation `_≉_` from the underlying `Setoid`.
60+
5661
* Added `Reflection.TypeChecking.Format.errorPartFmt`.
5762

5863
* Added new properties to `Data.List.Properties`:

src/Algebra/Bundles.agda

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ record Magma c ℓ : Set (suc (c ⊔ ℓ)) where
4444
rawMagma : RawMagma _ _
4545
rawMagma = record { _≈_ = _≈_; _∙_ = _∙_ }
4646

47+
open Setoid setoid public
48+
using (_≉_)
49+
4750

4851
record Semigroup c ℓ : Set (suc (c ⊔ ℓ)) where
4952
infixl 7 _∙_
@@ -59,7 +62,8 @@ record Semigroup c ℓ : Set (suc (c ⊔ ℓ)) where
5962
magma : Magma c ℓ
6063
magma = record { isMagma = isMagma }
6164

62-
open Magma magma public using (rawMagma)
65+
open Magma magma public
66+
using (_≉_; rawMagma)
6367

6468

6569
record Band c ℓ : Set (suc (c ⊔ ℓ)) where
@@ -76,7 +80,8 @@ record Band c ℓ : Set (suc (c ⊔ ℓ)) where
7680
semigroup : Semigroup c ℓ
7781
semigroup = record { isSemigroup = isSemigroup }
7882

79-
open Semigroup semigroup public using (magma; rawMagma)
83+
open Semigroup semigroup public
84+
using (_≉_; magma; rawMagma)
8085

8186

8287
record CommutativeSemigroup c ℓ : Set (suc (c ⊔ ℓ)) where
@@ -93,7 +98,8 @@ record CommutativeSemigroup c ℓ : Set (suc (c ⊔ ℓ)) where
9398
semigroup : Semigroup c ℓ
9499
semigroup = record { isSemigroup = isSemigroup }
95100

96-
open Semigroup semigroup public using (magma; rawMagma)
101+
open Semigroup semigroup public
102+
using (_≉_; magma; rawMagma)
97103

98104

99105
record Semilattice c ℓ : Set (suc (c ⊔ ℓ)) where
@@ -110,7 +116,8 @@ record Semilattice c ℓ : Set (suc (c ⊔ ℓ)) where
110116
band : Band c ℓ
111117
band = record { isBand = isBand }
112118

113-
open Band band public using (rawMagma; magma; semigroup)
119+
open Band band public
120+
using (_≉_; rawMagma; magma; semigroup)
114121

115122

116123
record SelectiveMagma c ℓ : Set (suc (c ⊔ ℓ)) where
@@ -127,7 +134,8 @@ record SelectiveMagma c ℓ : Set (suc (c ⊔ ℓ)) where
127134
magma : Magma c ℓ
128135
magma = record { isMagma = isMagma }
129136

130-
open Magma magma public using (rawMagma)
137+
open Magma magma public
138+
using (_≉_; rawMagma)
131139

132140
------------------------------------------------------------------------
133141
-- Bundles with 1 binary operation & 1 element
@@ -166,7 +174,8 @@ record Monoid c ℓ : Set (suc (c ⊔ ℓ)) where
166174
semigroup : Semigroup _ _
167175
semigroup = record { isSemigroup = isSemigroup }
168176

169-
open Semigroup semigroup public using (rawMagma; magma)
177+
open Semigroup semigroup public
178+
using (_≉_; rawMagma; magma)
170179

171180
rawMonoid : RawMonoid _ _
172181
rawMonoid = record { _≈_ = _≈_; _∙_ = _∙_; ε = ε}
@@ -187,7 +196,8 @@ record CommutativeMonoid c ℓ : Set (suc (c ⊔ ℓ)) where
187196
monoid : Monoid _ _
188197
monoid = record { isMonoid = isMonoid }
189198

190-
open Monoid monoid public using (rawMagma; magma; semigroup; rawMonoid)
199+
open Monoid monoid public
200+
using (_≉_; rawMagma; magma; semigroup; rawMonoid)
191201

192202
commutativeSemigroup : CommutativeSemigroup _ _
193203
commutativeSemigroup = record { isCommutativeSemigroup = isCommutativeSemigroup }
@@ -209,7 +219,7 @@ record IdempotentCommutativeMonoid c ℓ : Set (suc (c ⊔ ℓ)) where
209219
commutativeMonoid = record { isCommutativeMonoid = isCommutativeMonoid }
210220

211221
open CommutativeMonoid commutativeMonoid public
212-
using (rawMagma; magma; semigroup; rawMonoid; monoid)
222+
using (_≉_; rawMagma; magma; semigroup; rawMonoid; monoid)
213223

214224

215225
-- Idempotent commutative monoids are also known as bounded lattices.
@@ -268,7 +278,8 @@ record Group c ℓ : Set (suc (c ⊔ ℓ)) where
268278
monoid : Monoid _ _
269279
monoid = record { isMonoid = isMonoid }
270280

271-
open Monoid monoid public using (rawMagma; magma; semigroup; rawMonoid)
281+
open Monoid monoid public
282+
using (_≉_; rawMagma; magma; semigroup; rawMonoid)
272283

273284
record AbelianGroup c ℓ : Set (suc (c ⊔ ℓ)) where
274285
infix 8 _⁻¹
@@ -288,7 +299,7 @@ record AbelianGroup c ℓ : Set (suc (c ⊔ ℓ)) where
288299
group = record { isGroup = isGroup }
289300

290301
open Group group public
291-
using (rawMagma; magma; semigroup; monoid; rawMonoid; rawGroup)
302+
using (_≉_; rawMagma; magma; semigroup; monoid; rawMonoid; rawGroup)
292303

293304
commutativeMonoid : CommutativeMonoid _ _
294305
commutativeMonoid = record { isCommutativeMonoid = isCommutativeMonoid }
@@ -337,11 +348,15 @@ record Lattice c ℓ : Set (suc (c ⊔ ℓ)) where
337348
; _∨_ = _∨_
338349
}
339350

340-
open RawLattice rawLattice using (∨-rawMagma; ∧-rawMagma)
351+
open RawLattice rawLattice
352+
using (∨-rawMagma; ∧-rawMagma)
341353

342354
setoid : Setoid _ _
343355
setoid = record { isEquivalence = isEquivalence }
344356

357+
open Setoid setoid public
358+
using (_≉_)
359+
345360

346361
record DistributiveLattice c ℓ : Set (suc (c ⊔ ℓ)) where
347362
infixr 7 _∧_
@@ -359,7 +374,8 @@ record DistributiveLattice c ℓ : Set (suc (c ⊔ ℓ)) where
359374
lattice : Lattice _ _
360375
lattice = record { isLattice = isLattice }
361376

362-
open Lattice lattice public using (rawLattice; setoid)
377+
open Lattice lattice public
378+
using (_≉_; rawLattice; setoid)
363379

364380

365381
------------------------------------------------------------------------
@@ -419,7 +435,7 @@ record NearSemiring c ℓ : Set (suc (c ⊔ ℓ)) where
419435
+-monoid = record { isMonoid = +-isMonoid }
420436

421437
open Monoid +-monoid public
422-
using () renaming
438+
using (_≉_) renaming
423439
( rawMagma to +-rawMagma
424440
; magma to +-magma
425441
; semigroup to +-semigroup
@@ -455,7 +471,7 @@ record SemiringWithoutOne c ℓ : Set (suc (c ⊔ ℓ)) where
455471

456472
open NearSemiring nearSemiring public
457473
using
458-
( +-rawMagma; +-magma; +-semigroup
474+
( _≉_; +-rawMagma; +-magma; +-semigroup
459475
; +-rawMonoid; +-monoid
460476
; *-rawMagma; *-magma; *-semigroup
461477
; rawNearSemiring
@@ -490,7 +506,7 @@ record CommutativeSemiringWithoutOne c ℓ : Set (suc (c ⊔ ℓ)) where
490506

491507
open SemiringWithoutOne semiringWithoutOne public
492508
using
493-
( +-rawMagma; +-magma; +-semigroup; +-commutativeSemigroup
509+
( _≉_; +-rawMagma; +-magma; +-semigroup; +-commutativeSemigroup
494510
; *-rawMagma; *-magma; *-semigroup
495511
; +-rawMonoid; +-monoid; +-commutativeMonoid
496512
; nearSemiring; rawNearSemiring
@@ -565,7 +581,7 @@ record SemiringWithoutAnnihilatingZero c ℓ : Set (suc (c ⊔ ℓ)) where
565581
record { isCommutativeMonoid = +-isCommutativeMonoid }
566582

567583
open CommutativeMonoid +-commutativeMonoid public
568-
using () renaming
584+
using (_≉_) renaming
569585
( rawMagma to +-rawMagma
570586
; magma to +-magma
571587
; semigroup to +-semigroup
@@ -610,7 +626,7 @@ record Semiring c ℓ : Set (suc (c ⊔ ℓ)) where
610626
open SemiringWithoutAnnihilatingZero
611627
semiringWithoutAnnihilatingZero public
612628
using
613-
( +-rawMagma; +-magma; +-semigroup; +-commutativeSemigroup
629+
( _≉_; +-rawMagma; +-magma; +-semigroup; +-commutativeSemigroup
614630
; *-rawMagma; *-magma; *-semigroup
615631
; +-rawMonoid; +-monoid; +-commutativeMonoid
616632
; *-rawMonoid; *-monoid
@@ -645,7 +661,7 @@ record CommutativeSemiring c ℓ : Set (suc (c ⊔ ℓ)) where
645661

646662
open Semiring semiring public
647663
using
648-
( +-rawMagma; +-magma; +-semigroup; +-commutativeSemigroup
664+
( _≉_; +-rawMagma; +-magma; +-semigroup; +-commutativeSemigroup
649665
; *-rawMagma; *-magma; *-semigroup
650666
; +-rawMonoid; +-monoid; +-commutativeMonoid
651667
; *-rawMonoid; *-monoid
@@ -746,7 +762,7 @@ record Ring c ℓ : Set (suc (c ⊔ ℓ)) where
746762

747763
open Semiring semiring public
748764
using
749-
( +-rawMagma; +-magma; +-semigroup; +-commutativeSemigroup
765+
( _≉_; +-rawMagma; +-magma; +-semigroup; +-commutativeSemigroup
750766
; *-rawMagma; *-magma; *-semigroup
751767
; +-rawMonoid; +-monoid ; +-commutativeMonoid
752768
; *-rawMonoid; *-monoid
@@ -788,11 +804,12 @@ record CommutativeRing c ℓ : Set (suc (c ⊔ ℓ)) where
788804
ring : Ring _ _
789805
ring = record { isRing = isRing }
790806

807+
open Ring ring public using (_≉_; rawRing; +-group; +-abelianGroup)
808+
791809
commutativeSemiring : CommutativeSemiring _ _
792810
commutativeSemiring =
793811
record { isCommutativeSemiring = isCommutativeSemiring }
794812

795-
open Ring ring public using (rawRing; +-group; +-abelianGroup)
796813
open CommutativeSemiring commutativeSemiring public
797814
using
798815
( +-rawMagma; +-magma; +-semigroup; +-commutativeSemigroup
@@ -826,7 +843,7 @@ record BooleanAlgebra c ℓ : Set (suc (c ⊔ ℓ)) where
826843
distributiveLattice = record { isDistributiveLattice = isDistributiveLattice }
827844

828845
open DistributiveLattice distributiveLattice public
829-
using (setoid; lattice)
846+
using (_≉_; setoid; lattice)
830847

831848

832849
------------------------------------------------------------------------

src/Relation/Binary/Bundles.agda

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ record PartialSetoid a ℓ : Set (suc (a ⊔ ℓ)) where
2828

2929
open IsPartialEquivalence isPartialEquivalence public
3030

31+
infix 4 _≉_
3132
_≉_ : Rel Carrier _
3233
x ≉ y = ¬ (x ≈ y)
3334

0 commit comments

Comments
 (0)