We now define objects of the ring family, as we did for groups.
open import Agda.Primitive using (Level; _⊔_; lsuc; lzero)
open import Types.product
open import Types.relations
open import Types.equality
open import Algebra.groups
open import Algebra.groups2
open import Algebra.rings
module Algebra.rings2 where
record NearSemiring c ℓ : Set (lsuc (c ⊔ ℓ)) where
infixl 7 _*_
infixl 6 _+_
infix 4 _≈_
field
: Set c
Data _≈_ : Rel Data ℓ
_+_ : ★ Data
_*_ : ★ Data
: Data
0# : IsNearSemiring _≈_ _+_ _*_ 0#
isNearSemiring
open IsNearSemiring isNearSemiring public
: Monoid _ _
+-monoid = record { isMonoid = +-isMonoid }
+-monoid
open Monoid +-monoid public
using ()
renaming
( magma to +-magma
; semigroup to +-semigroup
)
: Semigroup _ _
*-semigroup = record { isSemigroup = *-isSemigroup }
*-semigroup
open Semigroup *-semigroup public
using ()
renaming ( magma to *-magma )
record SemiringWithoutOne c ℓ : Set (lsuc (c ⊔ ℓ)) where
infixl 7 _*_
infixl 6 _+_
infix 4 _≈_
field
: Set c
Data _≈_ : Rel Data ℓ
_+_ : ★ Data
_*_ : ★ Data
: Data
0# : IsSemiringWithoutOne _≈_ _+_ _*_ 0#
isSemiringWithoutOne
open IsSemiringWithoutOne isSemiringWithoutOne public
: NearSemiring _ _
nearSemiring = record { isNearSemiring = isNearSemiring }
nearSemiring
open NearSemiring nearSemiring public
using
( +-magma; +-semigroup; +-monoid
; *-magma; *-semigroup
)
: CommutativeMonoid _ _
+-commutativeMonoid =
+-commutativeMonoid record { isCommutativeMonoid = +-isCommutativeMonoid }
record SemiringWithoutAnnihilatingZero c ℓ : Set (lsuc (c ⊔ ℓ)) where
infixl 7 _*_
infixl 6 _+_
infix 4 _≈_
field
: Set c
Data _≈_ : Rel Data ℓ
_+_ : ★ Data
_*_ : ★ Data
: Data
0# : Data
1# :
isSemiringWithoutAnnihilatingZero _≈_ _+_ _*_ 0# 1#
IsSemiringWithoutAnnihilatingZero
open IsSemiringWithoutAnnihilatingZero
public
isSemiringWithoutAnnihilatingZero
: CommutativeMonoid _ _
+-commutativeMonoid =
+-commutativeMonoid record { isCommutativeMonoid = +-isCommutativeMonoid }
open CommutativeMonoid +-commutativeMonoid public
using ()
renaming
( magma to +-magma
; semigroup to +-semigroup
; monoid to +-monoid
)
: Monoid _ _
*-monoid = record { isMonoid = *-isMonoid }
*-monoid
open Monoid *-monoid public
using ()
renaming
( magma to *-magma
; semigroup to *-semigroup
)
record Semiring c ℓ : Set (lsuc (c ⊔ ℓ)) where
infixl 7 _*_
infixl 6 _+_
infix 4 _≈_
field
: Set c
Data _≈_ : Rel Data ℓ
_+_ : ★ Data
_*_ : ★ Data
: Data
0# : Data
1# : IsSemiring _≈_ _+_ _*_ 0# 1#
isSemiring
open IsSemiring isSemiring public
: SemiringWithoutAnnihilatingZero _ _
semiringWithoutAnnihilatingZero = record
semiringWithoutAnnihilatingZero { isSemiringWithoutAnnihilatingZero =
isSemiringWithoutAnnihilatingZero}
open SemiringWithoutAnnihilatingZero
public
semiringWithoutAnnihilatingZero using
( +-magma; +-semigroup
; *-magma; *-semigroup
; +-monoid; +-commutativeMonoid
; *-monoid
)
: SemiringWithoutOne _ _
semiringWithoutOne =
semiringWithoutOne record { isSemiringWithoutOne = isSemiringWithoutOne }
open SemiringWithoutOne semiringWithoutOne public
using (nearSemiring)
record CommutativeSemiringWithoutOne c ℓ : Set (lsuc (c ⊔ ℓ)) where
infixl 7 _*_
infixl 6 _+_
infix 4 _≈_
field
: Set c
Data _≈_ : Rel Data ℓ
_+_ : ★ Data
_*_ : ★ Data
: Data
0# :
isCommutativeSemiringWithoutOne _≈_ _+_ _*_ 0#
IsCommutativeSemiringWithoutOne
open IsCommutativeSemiringWithoutOne
public
isCommutativeSemiringWithoutOne
: SemiringWithoutOne _ _
semiringWithoutOne =
semiringWithoutOne record { isSemiringWithoutOne = isSemiringWithoutOne }
open SemiringWithoutOne semiringWithoutOne public
using
( +-magma; +-semigroup
; *-magma; *-semigroup
; +-monoid; +-commutativeMonoid
; nearSemiring
)
record CommutativeSemiring c ℓ : Set (lsuc (c ⊔ ℓ)) where
infixl 7 _*_
infixl 6 _+_
infix 4 _≈_
field
: Set c
Data _≈_ : Rel Data ℓ
_+_ : ★ Data
_*_ : ★ Data
: Data
0# : Data
1# : IsCommutativeSemiring _≈_ _+_ _*_ 0# 1#
isCommutativeSemiring
open IsCommutativeSemiring isCommutativeSemiring public
: Semiring _ _
semiring = record { isSemiring = isSemiring }
semiring
open Semiring semiring public
using
( +-magma; +-semigroup
; *-magma; *-semigroup
; +-monoid; +-commutativeMonoid
; *-monoid
; nearSemiring; semiringWithoutOne
; semiringWithoutAnnihilatingZero
)
: CommutativeMonoid _ _
*-commutativeMonoid =
*-commutativeMonoid record { isCommutativeMonoid = *-isCommutativeMonoid }
: CommutativeSemiringWithoutOne _ _
commutativeSemiringWithoutOne = record
commutativeSemiringWithoutOne { isCommutativeSemiringWithoutOne = isCommutativeSemiringWithoutOne
}
record Ring c ℓ : Set (lsuc (c ⊔ ℓ)) where
infix 8 -_
infixl 7 _*_
infixl 6 _+_
infix 4 _≈_
field
: Set c
Data _≈_ : Rel Data ℓ
_+_ : ★ Data
_*_ : ★ Data
_ : ♠ Data
-: Data
0# : Data
1# : IsRing _≈_ _+_ _*_ -_ 0# 1#
isRing
open IsRing isRing public
: AbelianGroup _ _
+-abelianGroup = record { isAbelianGroup = +-isAbelianGroup }
+-abelianGroup
: Semiring _ _
semiring = record { isSemiring = isSemiring }
semiring
open Semiring semiring public
using
( +-magma; +-semigroup
; *-magma; *-semigroup
; +-monoid ; +-commutativeMonoid
; *-monoid
; nearSemiring; semiringWithoutOne
; semiringWithoutAnnihilatingZero
)
open AbelianGroup +-abelianGroup public
using () renaming (group to +-group)
record CommutativeRing c ℓ : Set (lsuc (c ⊔ ℓ)) where
infix 8 -_
infixl 7 _*_
infixl 6 _+_
infix 4 _≈_
field
: Set c
Data _≈_ : Rel Data ℓ
_+_ : ★ Data
_*_ : ★ Data
_ : ♠ Data
-: Data
0# : Data
1# : IsCommutativeRing _≈_ _+_ _*_ -_ 0# 1#
isCommutativeRing
open IsCommutativeRing isCommutativeRing public
: Ring _ _
ring = record { isRing = isRing }
ring
: CommutativeSemiring _ _
commutativeSemiring =
commutativeSemiring record { isCommutativeSemiring = isCommutativeSemiring }
open Ring ring public using (+-group; +-abelianGroup)
open CommutativeSemiring commutativeSemiring public
using
( +-magma; +-semigroup
; *-magma; *-semigroup
; +-monoid; +-commutativeMonoid
; *-monoid; *-commutativeMonoid
; nearSemiring; semiringWithoutOne
; semiringWithoutAnnihilatingZero; semiring
; commutativeSemiringWithoutOne
)