← Back

Modules

Leios

  • Abstract
  • Base
  • Blocks
  • Config
  • FFD
  • KeyRegistration
  • Linear
  • Linear.Trace.Verifier
  • Linear.Trace.Verifier.Test
  • Prelude
  • Protocol
  • SpecStructure
  • Voting
  • VRF

Network

  • BasicBroadcast
123456789101112131415161718192021222324252627
{-# OPTIONS --cubical-compatible #-}
module Class.CommutativeMonoid.Core where
 
open import Class.Prelude
open import Class.Semigroup
open import Class.Monoid
 
import Algebra as Alg
 
record CommutativeMonoid c ℓ Carrier : Type (lsuc (c ⊔ ℓ)) where
infix 4 _≈_
field
_≈_ : Carrier → Carrier → Type ℓ
⦃ semigroup ⦄ : Semigroup Carrier
⦃ monoid ⦄ : Monoid Carrier
isCommutativeMonoid : Alg.IsCommutativeMonoid {c} _≈_ _◇_ ε
 
module Conversion {c ℓ} where
toBundle : ∀ {Carrier} → CommutativeMonoid c ℓ Carrier → Alg.CommutativeMonoid c ℓ
toBundle c = record { CommutativeMonoid c }
 
fromBundle : (m : Alg.CommutativeMonoid c ℓ)
→ CommutativeMonoid c ℓ (Alg.CommutativeMonoid.Carrier m)
fromBundle c = record
{ Alg.CommutativeMonoid c using (_≈_; isCommutativeMonoid)
; semigroup = λ where ._◇_ → Alg.CommutativeMonoid._∙_ c
; monoid = λ where .ε → Alg.CommutativeMonoid.ε c }