Skip to content

Commit 6c575be

Browse files
authored
Add CancellativeCommutativeSemiring (#1308)
1 parent 844de21 commit 6c575be

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Other minor additions
4444
```agda
4545
RawNearSemiring c ℓ : Set (suc (c ⊔ ℓ))
4646
RawLattice c ℓ : Set (suc (c ⊔ ℓ))
47+
CancellativeCommutativeSemiring c ℓ : Set (suc (c ⊔ ℓ))
4748
```
4849

4950
* Added new records to `Algebra.Morphism.Structures`:
@@ -59,4 +60,16 @@ Other minor additions
5960
IsLatticeIsomorphism (⟦_⟧ : A → B) : Set (a ⊔ b ⊔ ℓ₁ ⊔ ℓ₂)
6061
```
6162

63+
* Added new definitions to `Algebra.Definitions`:
64+
```agda
65+
AlmostLeftCancellative e _•_ = ∀ {x} y z → ¬ x ≈ e → (x • y) ≈ (x • z) → y ≈ z
66+
AlmostRightCancellative e _•_ = ∀ {x} y z → ¬ x ≈ e → (y • x) ≈ (z • x) → y ≈ z
67+
AlmostCancellative e _•_ = AlmostLeftCancellative e _•_ × AlmostRightCancellative e _•_
68+
```
69+
70+
* Added new record to `Algebra.Structures`:
71+
```agda
72+
IsCancellativeCommutativeSemiring (+ * : Op₂ A) (0# 1# : A) : Set (a ⊔ ℓ)
73+
```
74+
6275
* Add version to library name

src/Algebra/Bundles.agda

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,22 @@ record CommutativeSemiring c ℓ : Set (suc (c ⊔ ℓ)) where
670670
}
671671

672672

673+
record CancellativeCommutativeSemiring c ℓ : Set (suc (c ⊔ ℓ)) where
674+
infixl 7 _*_
675+
infixl 6 _+_
676+
infix 4 _≈_
677+
field
678+
Carrier : Set c
679+
_≈_ : Rel Carrier ℓ
680+
_+_ : Op₂ Carrier
681+
_*_ : Op₂ Carrier
682+
0# : Carrier
683+
1# : Carrier
684+
isCancellativeCommutativeSemiring : IsCancellativeCommutativeSemiring _≈_ _+_ _*_ 0# 1#
685+
686+
open IsCancellativeCommutativeSemiring isCancellativeCommutativeSemiring public
687+
688+
673689
------------------------------------------------------------------------
674690
-- Bundles with 2 binary operations, 1 unary operation & 2 elements
675691
------------------------------------------------------------------------

src/Algebra/Definitions.agda

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
{-# OPTIONS --without-K --safe #-}
1111

1212
open import Relation.Binary.Core
13+
open import Relation.Nullary using (¬_)
1314

1415
module Algebra.Definitions
1516
{a ℓ} {A : Set a} -- The underlying set
@@ -118,5 +119,14 @@ RightCancellative _•_ = ∀ {x} y z → (y • x) ≈ (z • x) → y ≈ z
118119
Cancellative : Op₂ A Set _
119120
Cancellative _•_ = (LeftCancellative _•_) × (RightCancellative _•_)
120121

122+
AlmostLeftCancellative : A Op₂ A Set _
123+
AlmostLeftCancellative e _•_ = {x} y z ¬ x ≈ e (x • y) ≈ (x • z) y ≈ z
124+
125+
AlmostRightCancellative : A Op₂ A Set _
126+
AlmostRightCancellative e _•_ = {x} y z ¬ x ≈ e (y • x) ≈ (z • x) y ≈ z
127+
128+
AlmostCancellative : A Op₂ A Set _
129+
AlmostCancellative e _•_ = AlmostLeftCancellative e _•_ × AlmostRightCancellative e _•_
130+
121131
Interchangable : Op₂ A Op₂ A Set _
122132
Interchangable _∘_ _∙_ = w x y z ((w ∙ x) ∘ (y ∙ z)) ≈ ((w ∘ y) ∙ (x ∘ z))

src/Algebra/Structures.agda

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,15 @@ record IsCommutativeSemiring (+ * : Op₂ A) (0# 1# : A) : Set (a ⊔ ℓ) where
425425
}
426426

427427

428+
record IsCancellativeCommutativeSemiring (+ * : Op₂ A) (0# 1# : A) : Set (a ⊔ ℓ) where
429+
field
430+
isCommutativeSemiring : IsCommutativeSemiring + * 0# 1#
431+
*-cancelˡ-nonZero : AlmostLeftCancellative 0# *
432+
433+
open IsCommutativeSemiring isCommutativeSemiring public
434+
435+
436+
428437
------------------------------------------------------------------------
429438
-- Structures with 2 binary operations, 1 unary operation & 2 elements
430439
------------------------------------------------------------------------

0 commit comments

Comments
 (0)