Skip to content

Commit 67377a0

Browse files
Akshobhya1234MatthewDaggitt
authored andcommitted
Direct products and minor fixes (#1909)
1 parent af9ab55 commit 67377a0

File tree

4 files changed

+124
-6
lines changed

4 files changed

+124
-6
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1888,6 +1888,11 @@ Other minor changes
18881888
rightBolLoop : RightBolLoop a ℓ₁ → RightBolLoop b ℓ₂ → RightBolLoop (a ⊔ b) (ℓ₁ ⊔ ℓ₂)
18891889
middleBolLoop : MiddleBolLoop a ℓ₁ → MiddleBolLoop b ℓ₂ → MiddleBolLoop (a ⊔ b) (ℓ₁ ⊔ ℓ₂)
18901890
moufangLoop : MoufangLoop a ℓ₁ → MoufangLoop b ℓ₂ → MoufangLoop (a ⊔ b) (ℓ₁ ⊔ ℓ₂)
1891+
rawRingWithoutOne : RawRingWithoutOne a ℓ₁ → RawRingWithoutOne b ℓ₂ → RawRingWithoutOne (a ⊔ b) (ℓ₁ ⊔ ℓ₂)
1892+
ringWithoutOne : RingWithoutOne a ℓ₁ → RingWithoutOne b ℓ₂ → RingWithoutOne (a ⊔ b) (ℓ₁ ⊔ ℓ₂)
1893+
nonAssociativeRing : NonAssociativeRing a ℓ₁ → NonAssociativeRing b ℓ₂ → NonAssociativeRing (a ⊔ b) (ℓ₁ ⊔ ℓ₂)
1894+
quasiring : Quasiring a ℓ₁ → Quasiring b ℓ₂ → Quasiring (a ⊔ b) (ℓ₁ ⊔ ℓ₂)
1895+
nearring : Nearring a ℓ₁ → Nearring b ℓ₂ → Nearring (a ⊔ b) (ℓ₁ ⊔ ℓ₂)
18911896
```
18921897

18931898
* Added new definition to `Algebra.Definitions`:

src/Algebra/Bundles.agda

+7
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,12 @@ record NonAssociativeRing c ℓ : Set (suc (c ⊔ ℓ)) where
892892
open AbelianGroup +-abelianGroup public
893893
using () renaming (group to +-group; invertibleMagma to +-invertibleMagma; invertibleUnitalMagma to +-invertibleUnitalMagma)
894894

895+
*-unitalMagma : UnitalMagma _ _
896+
*-unitalMagma = record { isUnitalMagma = *-isUnitalMagma}
897+
898+
open UnitalMagma *-unitalMagma public
899+
using () renaming (magma to *-magma; identity to *-identity)
900+
895901
record Nearring c ℓ : Set (suc (c ⊔ ℓ)) where
896902
infixl 7 _*_
897903
infixl 6 _+_
@@ -1158,3 +1164,4 @@ record MiddleBolLoop c ℓ : Set (suc (c ⊔ ℓ)) where
11581164

11591165
open Loop loop public
11601166
using (quasigroup)
1167+

src/Algebra/Construct/DirectProduct.agda

+63
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ rawSemiring R S = record
6161
; 1# = R.1# , S.1#
6262
} where module R = RawSemiring R; module S = RawSemiring S
6363

64+
rawRingWithoutOne : RawRingWithoutOne a ℓ₁ RawRingWithoutOne b ℓ₂ RawRingWithoutOne (a ⊔ b) (ℓ₁ ⊔ ℓ₂)
65+
rawRingWithoutOne R S = record
66+
{ Carrier = R.Carrier × S.Carrier
67+
; _≈_ = Pointwise R._≈_ S._≈_
68+
; _+_ = zip R._+_ S._+_
69+
; _*_ = zip R._*_ S._*_
70+
; -_ = map R.-_ S.-_
71+
; 0# = R.0# , S.0#
72+
} where module R = RawRingWithoutOne R; module S = RawRingWithoutOne S
73+
6474
rawRing : RawRing a ℓ₁ RawRing b ℓ₂ RawRing (a ⊔ b) (ℓ₁ ⊔ ℓ₂)
6575
rawRing R S = record
6676
{ Carrier = R.Carrier × S.Carrier
@@ -317,6 +327,59 @@ kleeneAlgebra K L = record
317327
}
318328
} where module K = KleeneAlgebra K; module L = KleeneAlgebra L
319329

330+
ringWithoutOne : RingWithoutOne a ℓ₁ RingWithoutOne b ℓ₂ RingWithoutOne (a ⊔ b) (ℓ₁ ⊔ ℓ₂)
331+
ringWithoutOne R S = record
332+
{ isRingWithoutOne = record
333+
{ +-isAbelianGroup = AbelianGroup.isAbelianGroup ((abelianGroup R.+-abelianGroup S.+-abelianGroup))
334+
; *-cong = Semigroup.∙-cong (semigroup R.*-semigroup S.*-semigroup)
335+
; *-assoc = Semigroup.assoc (semigroup R.*-semigroup S.*-semigroup)
336+
; distrib = (λ x y z (R.distribˡ , S.distribˡ) <*> x <*> y <*> z)
337+
, (λ x y z (R.distribʳ , S.distribʳ) <*> x <*> y <*> z)
338+
; zero = uncurry (λ x y R.zeroˡ x , S.zeroˡ y)
339+
, uncurry (λ x y R.zeroʳ x , S.zeroʳ y)
340+
}
341+
342+
} where module R = RingWithoutOne R; module S = RingWithoutOne S
343+
344+
nonAssociativeRing : NonAssociativeRing a ℓ₁ NonAssociativeRing b ℓ₂ NonAssociativeRing (a ⊔ b) (ℓ₁ ⊔ ℓ₂)
345+
nonAssociativeRing R S = record
346+
{ isNonAssociativeRing = record
347+
{ +-isAbelianGroup = AbelianGroup.isAbelianGroup ((abelianGroup R.+-abelianGroup S.+-abelianGroup))
348+
; *-cong = UnitalMagma.∙-cong (unitalMagma R.*-unitalMagma S.*-unitalMagma)
349+
; *-identity = UnitalMagma.identity (unitalMagma R.*-unitalMagma S.*-unitalMagma)
350+
; distrib = (λ x y z (R.distribˡ , S.distribˡ) <*> x <*> y <*> z)
351+
, (λ x y z (R.distribʳ , S.distribʳ) <*> x <*> y <*> z)
352+
; zero = uncurry (λ x y R.zeroˡ x , S.zeroˡ y)
353+
, uncurry (λ x y R.zeroʳ x , S.zeroʳ y)
354+
}
355+
356+
} where module R = NonAssociativeRing R; module S = NonAssociativeRing S
357+
358+
quasiring : Quasiring a ℓ₁ Quasiring b ℓ₂ Quasiring (a ⊔ b) (ℓ₁ ⊔ ℓ₂)
359+
quasiring R S = record
360+
{ isQuasiring = record
361+
{ +-isMonoid = Monoid.isMonoid ((monoid R.+-monoid S.+-monoid))
362+
; *-cong = Monoid.∙-cong (monoid R.*-monoid S.*-monoid)
363+
; *-assoc = Monoid.assoc (monoid R.*-monoid S.*-monoid)
364+
; *-identity = Monoid.identity ((monoid R.*-monoid S.*-monoid))
365+
; distrib = (λ x y z (R.distribˡ , S.distribˡ) <*> x <*> y <*> z)
366+
, (λ x y z (R.distribʳ , S.distribʳ) <*> x <*> y <*> z)
367+
; zero = uncurry (λ x y R.zeroˡ x , S.zeroˡ y)
368+
, uncurry (λ x y R.zeroʳ x , S.zeroʳ y)
369+
}
370+
371+
} where module R = Quasiring R; module S = Quasiring S
372+
373+
nearring : Nearring a ℓ₁ Nearring b ℓ₂ Nearring (a ⊔ b) (ℓ₁ ⊔ ℓ₂)
374+
nearring R S = record
375+
{ isNearring = record
376+
{ isQuasiring = Quasiring.isQuasiring (quasiring R.quasiring S.quasiring)
377+
; +-inverse = (λ x (R.+-inverseˡ , S.+-inverseˡ) <*> x)
378+
, (λ x (R.+-inverseʳ , S.+-inverseʳ) <*> x)
379+
; ⁻¹-cong = map R.⁻¹-cong S.⁻¹-cong
380+
}
381+
} where module R = Nearring R; module S = Nearring S
382+
320383
ring : Ring a ℓ₁ Ring b ℓ₂ Ring (a ⊔ b) (ℓ₁ ⊔ ℓ₂)
321384
ring R S = record
322385
{ -_ = uncurry (λ x y R.-_ x , S.-_ y)

src/Algebra/Structures.agda

+49-6
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,24 @@ record IsQuasiring (+ * : Op₂ A) (0# 1# : A) : Set (a ⊔ ℓ) where
594594
; isSemigroup to +-isSemigroup
595595
)
596596

597+
distribˡ : * DistributesOverˡ +
598+
distribˡ = proj₁ distrib
599+
600+
distribʳ : * DistributesOverʳ +
601+
distribʳ = proj₂ distrib
602+
603+
zeroˡ : LeftZero 0# *
604+
zeroˡ = proj₁ zero
605+
606+
zeroʳ : RightZero 0# *
607+
zeroʳ = proj₂ zero
608+
609+
identityˡ : LeftIdentity 1# *
610+
identityˡ = proj₁ *-identity
611+
612+
identityʳ : RightIdentity 1# *
613+
identityʳ = proj₂ *-identity
614+
597615
*-isMagma : IsMagma *
598616
*-isMagma = record
599617
{ isEquivalence = isEquivalence
@@ -683,11 +701,11 @@ record IsRingWithoutOne (+ * : Op₂ A) (-_ : Op₁ A) (0# : A) : Set (a ⊔ ℓ
683701
; assoc = *-assoc
684702
}
685703

686-
open IsMagma *-isMagma public
704+
open IsSemigroup *-isSemigroup public
687705
using ()
688706
renaming
689-
( ∙-congˡ to *-congˡ
690-
; ∙-congʳ to *-congʳ
707+
( ∙-congˡ to *-congˡ
708+
; ∙-congʳ to *-congʳ
691709
)
692710

693711
------------------------------------------------------------------------
@@ -698,7 +716,7 @@ record IsNonAssociativeRing (+ * : Op₂ A) (-_ : Op₁ A) (0# 1# : A) : Set (a
698716
field
699717
+-isAbelianGroup : IsAbelianGroup + 0# -_
700718
*-cong : Congruent₂ *
701-
identity : Identity 1# *
719+
*-identity : Identity 1# *
702720
distrib : * DistributesOver +
703721
zero : Zero 0# *
704722

@@ -728,17 +746,42 @@ record IsNonAssociativeRing (+ * : Op₂ A) (-_ : Op₁ A) (0# 1# : A) : Set (a
728746
; isGroup to +-isGroup
729747
)
730748

749+
zeroˡ : LeftZero 0# *
750+
zeroˡ = proj₁ zero
751+
752+
zeroʳ : RightZero 0# *
753+
zeroʳ = proj₂ zero
754+
755+
distribˡ : * DistributesOverˡ +
756+
distribˡ = proj₁ distrib
757+
758+
distribʳ : * DistributesOverʳ +
759+
distribʳ = proj₂ distrib
760+
731761
*-isMagma : IsMagma *
732762
*-isMagma = record
733763
{ isEquivalence = isEquivalence
734764
; ∙-cong = *-cong
735765
}
736766

737767
*-identityˡ : LeftIdentity 1# *
738-
*-identityˡ = proj₁ identity
768+
*-identityˡ = proj₁ *-identity
739769

740770
*-identityʳ : RightIdentity 1# *
741-
*-identityʳ = proj₂ identity
771+
*-identityʳ = proj₂ *-identity
772+
773+
*-isUnitalMagma : IsUnitalMagma * 1#
774+
*-isUnitalMagma = record
775+
{ isMagma = *-isMagma
776+
; identity = *-identity
777+
}
778+
779+
open IsUnitalMagma *-isUnitalMagma public
780+
using ()
781+
renaming
782+
( ∙-congˡ to *-congˡ
783+
; ∙-congʳ to *-congʳ
784+
)
742785

743786
record IsNearring (+ * : Op₂ A) (0# 1# : A) (_⁻¹ : Op₁ A) : Set (a ⊔ ℓ) where
744787
field

0 commit comments

Comments
 (0)