open import 1Lab.Prelude

open import Algebra.Magma.Unital
open import Algebra.Semigroup
open import Algebra.Monoid

module Algebra.Magma.Unital.EckmannHilton where

The Eckmann-Hilton ArgumentπŸ”—

The Eckmann-Hilton argument shows that two unital magmas on the same carrier type that satisfy a particular interchange law are not only equal to another, but are also commutative and associative.

More precisely, let (A,e,⋆)(A,e,\star) and (A,eβ€²,⋆′)(A,e',\star') two unital magmas such that (a⋆b)⋆′(c⋆d)=(a⋆′c)⋆(b⋆′d)(a \star b) \star' (c \star d) = (a \star' c) \star (b \star' d).

module _ {β„“ : _} {A : Type β„“} {_⋆_ : A β†’ A β†’ A} {_⋆'_ : A β†’ A β†’ A} {e : A} {e' : A}
  (unital-mgm : is-unital-magma e _⋆_) (unital-mgm' : is-unital-magma e' _⋆'_)
  (interchange : (a b c d : A) β†’ (a ⋆ b) ⋆' (c ⋆ d) ≑ (a ⋆' c) ⋆ (b ⋆' d)) where

Then, one can first show that both operations share a unit, i.e.Β e=eβ€²e = e'. Notably, this holds because the units can be expanded to products of themselves, which can then be transformed into another by making use of the interchange equation.

  units-equal : e ≑ e'
  units-equal =
    e                        β‰‘βŸ¨ sym (idl unital-mgm) βŸ©β‰‘
    (e ⋆ e)                  β‰‘βŸ¨ apβ‚‚ _⋆_ (sym (idl unital-mgm')) (sym (idr unital-mgm')) βŸ©β‰‘
    ((e' ⋆'  e) ⋆ (e ⋆' e')) β‰‘βŸ¨ sym (interchange e' e e e') βŸ©β‰‘
    ((e' ⋆ e) ⋆' (e ⋆ e'))   β‰‘βŸ¨ apβ‚‚ _⋆'_ (idr unital-mgm) (idl unital-mgm) βŸ©β‰‘
    (e' ⋆' e')               β‰‘βŸ¨ idl unital-mgm' βŸ©β‰‘
    e' ∎

From there on, we are able to derive that one operation is equal to the dual of the other, once again by using the interchange law as well as swapping units whenever needed.

  ⋆-reverse-⋆' : (x y : A) β†’ x ⋆ y ≑ y ⋆' x
  ⋆-reverse-⋆' x y =
    x ⋆ y                 β‰‘βŸ¨ apβ‚‚ _⋆_ (sym (idl unital-mgm')) (sym (idr unital-mgm')) βŸ©β‰‘
    (e' ⋆' x) ⋆ (y ⋆' e') β‰‘βŸ¨ sym (interchange e' y x e') βŸ©β‰‘
    (e' ⋆ y) ⋆' (x ⋆ e')  β‰‘βŸ¨ apβ‚‚ _⋆'_ (ap (_⋆ y) (sym units-equal)) (ap (x ⋆_) (sym units-equal)) βŸ©β‰‘
    (e ⋆ y) ⋆' (x ⋆ e)    β‰‘βŸ¨ apβ‚‚ _⋆'_ (idl unital-mgm) (idr unital-mgm) βŸ©β‰‘
    y ⋆' x ∎

By a similar method, we can show pointwise equality of the two operators.

  operations-equal : (x y : A) β†’ x ⋆ y ≑ x ⋆' y
  operations-equal x y =
    x ⋆ y                 β‰‘βŸ¨ apβ‚‚ _⋆_ (sym (idr unital-mgm')) (sym (idl unital-mgm')) βŸ©β‰‘
    (x ⋆' e') ⋆ (e' ⋆' y) β‰‘βŸ¨ sym (interchange x e' e' y) βŸ©β‰‘
    (x ⋆ e') ⋆' (e' ⋆ y)  β‰‘βŸ¨ apβ‚‚ _⋆'_ (sym (ap (_⋆_ x) units-equal)) (sym (ap (_⋆ y) units-equal)) βŸ©β‰‘
    (x ⋆ e) ⋆' (e ⋆ y)    β‰‘βŸ¨ apβ‚‚ _⋆'_ (idr unital-mgm) (idl unital-mgm) βŸ©β‰‘
    x ⋆' y ∎

These two properties make it rather straightforward to show that ⋆\star is commutative - since we know that a⋆b=a⋆′ba \star b = a \star' b as well as a⋆b=b⋆′aa \star b = b \star' a, the proof can be completed by simple path concatenation.

  ⋆-commutative : (x y : A) β†’ x ⋆ y ≑ y ⋆ x
  ⋆-commutative x y = ⋆-reverse-⋆' x y βˆ™ sym (operations-equal y x)

Finally, associativity of the operation can be established by what can be informally described as rotating the elements of the product, using commutativity inside the factors of a products that can then be interchanged and reduced. Thus, associativity combined with the assumed unitality allows us to prove that the operation is a monoid.

  ⋆-associative : (x y z : A) β†’ x ⋆ (y ⋆ z) ≑ (x ⋆ y) ⋆ z
  ⋆-associative x y z = sym (
    (x ⋆ y) ⋆ z         β‰‘βŸ¨ ap (Ξ» a β†’ (x ⋆ y) ⋆ a) (sym (idr unital-mgm)) βŸ©β‰‘
    (x ⋆ y) ⋆ (z ⋆ e)   β‰‘βŸ¨ ap (Ξ» x β†’ x ⋆ (z ⋆ e)) (⋆-commutative x y) βŸ©β‰‘
    (y ⋆ x) ⋆ (z ⋆ e)   β‰‘βŸ¨ operations-equal (y ⋆ x) (z ⋆ e) βŸ©β‰‘
    (y ⋆ x) ⋆' (z ⋆ e)  β‰‘βŸ¨ interchange y x z e βŸ©β‰‘
    (y ⋆' z) ⋆ (x ⋆' e) β‰‘βŸ¨ ⋆-commutative (y ⋆' z) (x ⋆' e) βŸ©β‰‘
    (x ⋆' e) ⋆ (y ⋆' z) β‰‘βŸ¨ apβ‚‚ _⋆_ (sym (operations-equal x e)) (sym (operations-equal y z)) βŸ©β‰‘
    (x ⋆ e) ⋆ (y ⋆ z)   β‰‘βŸ¨ ap (_⋆ (y ⋆ z)) (idr unital-mgm) βŸ©β‰‘
    x ⋆ (y ⋆ z) ∎)

  ⋆-is-monoid : is-monoid e _⋆_
  ⋆-is-monoid .has-is-semigroup .has-is-magma = unital-mgm .has-is-magma
  ⋆-is-monoid .has-is-semigroup .associative = ⋆-associative _ _ _
  ⋆-is-monoid .idl = unital-mgm .idl
  ⋆-is-monoid .idr = unital-mgm .idr