module Algebra.Quasigroup.Instances.Group whereGroups and quasigroupsπ
private variable
β : Level
A : Type βEvery group is a quasigroup, as multiplication in a group is an equivalence.
is-groupβis-left-quasigroup
: β {_β_ : A β A β A}
β is-group _β_
β is-left-quasigroup _β_
is-groupβis-left-quasigroup {_β_ = _β_} β-group =
β-equivlβis-left-quasigroup (hlevel 2) β-equivl
where open is-group β-group
is-groupβis-right-quasigroup
: β {_β_ : A β A β A}
β is-group _β_
β is-right-quasigroup _β_
is-groupβis-right-quasigroup {_β_ = _β_} β-group =
β-equivrβis-right-quasigroup (hlevel 2) β-equivr
where open is-group β-group
is-groupβis-quasigroup
: β {_β_ : A β A β A}
β is-group _β_
β is-quasigroup _β_
is-groupβis-quasigroup {_β_ = _β_} β-group .is-quasigroup.has-is-left-quasigroup =
is-groupβis-left-quasigroup β-group
is-groupβis-quasigroup {_β_ = _β_} β-group .is-quasigroup.has-is-right-quasigroup =
is-groupβis-right-quasigroup β-groupAssociative quasigroups as groupsπ
Conversely, if a quasigroup is merely inhabited and associative, then it is a group.
associative+is-quasigroupβis-group
: β {_β_ : A β A β A}
β β₯ A β₯
β (β x y z β x β (y β z) β‘ (x β y) β z)
β is-quasigroup _β_
β is-group _β_We start by observing that is-group is an h-prop, so it
suffices to consider the case where
is inhabited.
associative+is-quasigroupβis-group {A = A} {_β_ = _β_} β₯aβ₯ β-assoc β-quasi =
rec! (Ξ» a β to-is-group (β-group a)) β₯aβ₯ where
open is-quasigroup β-quasi renaming (has-is-magma to β-magma)
open make-groupNext, a useful technical lemma: if then
β§΅-/-comm
: β {a b x y}
β x β b β‘ a β y
β x β§΅ a β‘ b / yThe proof is an elegant bit of algebra. Recall that in a quasigroup, is left and right cancellative, so it suffices to show that:
Next, and so it remains to show that Crucially, is associative, so:
which completes the proof.
β§΅-/-comm {a} {b} {x} {y} comm =
β-cancell x $ β-cancelr y $
(x β (x β§΅ a)) β y β‘β¨ ap (_β y) (β§΅-invr x a) β©
a β y β‘Λβ¨ comm β©
x β b β‘Λβ¨ ap (x β_) (/-invl b y) β©
x β ((b / y) β y) β‘β¨ β-assoc x (b / y) y β©
(x β (b / y)) β y βWith that out of the way, we shall show that
forms a group for any
β-group : A β make-group A
β-group a .group-is-set = hlevel 2
β-group a .unit = a β§΅ a
β-group a .mul x y = x β y
β-group a .inv x = (a β§΅ a) / xAssociativity is one of our hypotheses, so all that remains is left inverses and left identities. Next, note that
is just one of the quasigroup axioms. Finally, our lemma gives us so we have:
which completes the proof.
β-group a .assoc x y z =
β-assoc x y z
β-group a .invl x =
/-invl (a β§΅ a) x
β-group a .idl x =
(a β§΅ a) β x β‘β¨ ap (_β x) (β§΅-/-comm refl) β©
(x / x) β x β‘β¨ /-invl x x β©
x βTaking a step back, this result demonstrates that associative quasigroups behave like potentially empty groups.