Magmas

Content created by Fredrik Bakke, Egbert Rijke, Jonathan Prieto-Cubides and favonia.

Created on 2022-05-07.
Last modified on 2024-03-20.

module structured-types.magmas where
Imports
open import foundation.cartesian-product-types
open import foundation.dependent-pair-types
open import foundation.identity-types
open import foundation.unital-binary-operations
open import foundation.universe-levels

Idea

A magma is a type equipped with a binary operation.

Definition

Magma : (l : Level)  UU (lsuc l)
Magma l = Σ (UU l)  A  A  A  A)

module _
  {l : Level} (M : Magma l)
  where

  type-Magma : UU l
  type-Magma = pr1 M

  mul-Magma : type-Magma  type-Magma  type-Magma
  mul-Magma = pr2 M

  mul-Magma' : type-Magma  type-Magma  type-Magma
  mul-Magma' x y = mul-Magma y x

Structures

Unital magmas

is-unital-Magma : {l : Level} (M : Magma l)  UU l
is-unital-Magma M = is-unital (mul-Magma M)

Unital-Magma : (l : Level)  UU (lsuc l)
Unital-Magma l = Σ (Magma l) is-unital-Magma

magma-Unital-Magma :
  {l : Level}  Unital-Magma l  Magma l
magma-Unital-Magma M = pr1 M

is-unital-magma-Unital-Magma :
  {l : Level} (M : Unital-Magma l)  is-unital-Magma (magma-Unital-Magma M)
is-unital-magma-Unital-Magma M = pr2 M

Semigroups

is-semigroup-Magma : {l : Level}  Magma l  UU l
is-semigroup-Magma M =
  (x y z : type-Magma M) 
  Id (mul-Magma M (mul-Magma M x y) z) (mul-Magma M x (mul-Magma M y z))

Commutative magmas

is-commutative-Magma : {l : Level}  Magma l  UU l
is-commutative-Magma M =
  (x y : type-Magma M)  Id (mul-Magma M x y) (mul-Magma M y x)

The structure of a commutative monoid on magmas

is-commutative-monoid-Magma : {l : Level}  Magma l  UU l
is-commutative-monoid-Magma M =
  ((is-semigroup-Magma M) × (is-unital-Magma M)) × (is-commutative-Magma M)

unit-is-commutative-monoid-Magma :
  {l : Level} (M : Magma l)  is-commutative-monoid-Magma M  type-Magma M
unit-is-commutative-monoid-Magma M H = pr1 (pr2 (pr1 H))

Recent changes