← Back

Modules

CategoricalCrypto

  • CategoricalCrypto
  • Channel.Category
  • Channel.Core
  • Channel.Selection
  • Examples.Basic
  • Examples.Commitment
  • Examples.Signatures
  • Machine.Constraints
  • Machine.Core
  • SFunM

Categories

  • Discrete
  • FreeMonoidal
  • FreeStrictMonoidal
  • GradedKleisli
  • MonoidalCoherence
  • NaturalTransformationHelper
  • Properties

Class

  • Monad.Ext
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 }