Here we define the objects based on the conditions defined in the previous section. It might be helpful here to think
of Data
fields as various common datatypes as used in computer sciences, and the objects as the structure
defined on operations of that datatype.
We are bound to write this code in a new file as we are using a different module without the pre-supplied
_==_
and A : Set a
.
module Algebra.groups2 where
open import Agda.Primitive using (Level; _⊔_; lsuc; lzero)
open import Types.relations
open import Types.equality
open import Algebra.groups
We recall operations again here:
_ : ∀ {a} → Set a → Set a
★= A → A → A
★ A
_ : ∀ {a} → Set a → Set a
♠= A → A ♠ A
record Magma a ℓ : Set (lsuc (a ⊔ ℓ)) where
infixl 7 _∙_
infix 4 _==_
field
: Set a
Data _==_ : Rel Data ℓ
_∙_ : ★ Data
: IsMagma _==_ _∙_
isMagma
open IsMagma isMagma public
record Semigroup c ℓ : Set (lsuc (c ⊔ ℓ)) where
infixl 7 _∙_
infix 4 _==_
field
: Set c
Data _==_ : Rel Data ℓ
_∙_ : ★ Data
: IsSemigroup _==_ _∙_
isSemigroup
open IsSemigroup isSemigroup public
: Magma c ℓ
magma = record { isMagma = isMagma } magma
record Monoid c ℓ : Set (lsuc (c ⊔ ℓ)) where
infixl 7 _∙_
infix 4 _==_
field
: Set c
Data _==_ : Rel Data ℓ
_∙_ : ★ Data
: Data
ε : IsMonoid _==_ _∙_ ε
isMonoid
open IsMonoid isMonoid public
: Semigroup c ℓ
semigroup = record { isSemigroup = isSemigroup }
semigroup
: Magma c ℓ
magma = record { isMagma = isMagma } magma
record CommutativeMonoid c ℓ : Set (lsuc (c ⊔ ℓ)) where
infixl 7 _∙_
infix 4 _==_
field
: Set c
Data _==_ : Rel Data ℓ
_∙_ : ★ Data
: Data
ε : IsCommutativeMonoid _==_ _∙_ ε
isCommutativeMonoid
open IsCommutativeMonoid isCommutativeMonoid public
: Monoid c ℓ
monoid = record { isMonoid = isMonoid }
monoid
: Semigroup c ℓ
semigroup = record { isSemigroup = isSemigroup }
semigroup
: Magma c ℓ
magma = record { isMagma = isMagma } magma
record Group c ℓ : Set (lsuc (c ⊔ ℓ)) where
infix 8 _⁻¹
infixl 7 _∙_
infix 4 _==_
field
: Set c
Data _==_ : Rel Data ℓ
_∙_ : ★ Data
: Data
ε _⁻¹ : ♠ Data
: IsGroup _==_ _∙_ ε _⁻¹
isGroup
open IsGroup isGroup public
: Monoid _ _
monoid = record { isMonoid = isMonoid }
monoid
: Semigroup c ℓ
semigroup = record { isSemigroup = isSemigroup }
semigroup
: Magma c ℓ
magma = record { isMagma = isMagma } magma
open import Algebra.groups using (IsAbelianGroup)
record AbelianGroup c ℓ : Set (lsuc (c ⊔ ℓ)) where
infix 8 _⁻¹
infixl 7 _∙_
infix 4 _==_
field
: Set c
Data _==_ : Rel Data ℓ
_∙_ : ★ Data
: Data
ε _⁻¹ : ♠ Data
: IsAbelianGroup _==_ _∙_ ε _⁻¹
isAbelianGroup
open IsAbelianGroup isAbelianGroup public
: Group c ℓ
group = record { isGroup = isGroup }
group
: Monoid _ _
monoid = record { isMonoid = isMonoid }
monoid
: Semigroup c ℓ
semigroup = record { isSemigroup = isSemigroup }
semigroup
: Magma c ℓ
magma = record { isMagma = isMagma } magma