nLab magma

Binary operations

Binary operations


A binary operation on a set SS is a function ()():S×SS(-)\cdot (-) \colon S \times S \to S from the Cartesian product S×SS \times S to SS. A magma (or binary algebraic structure, or, alternatively, a mono-binary algebra) (S,)(S,\cdot) is a set equipped with a binary operation on it.

A magma is called

  • unital if it has a neutral element; that is, an element 1S1 \in S such that 1x=x=x11 \cdot x = x = x \cdot 1. Some authors mean by ‘magma’ what we call a unital magma (cf. Borceux-Bourn Def. 1.2.1). One can consider one-sided unital elements separately: 1 Lx=x1_L \cdot x = x and/or x=x1 Rx = x \cdot 1_R. Note that units may be far from unique.

  • commutative if the binary operation takes the same value when its two arguments are interchanged: xy=yxx \cdot y = y \cdot x.

  • associative if the binary operation satisfies the associativity condition (xy)z=x(yz)(x \cdot y) \cdot z = x \cdot (y \cdot z).

  • invertible if it has an inverse element.

  • an absorption magma if it has an element 0S0 \in S such that the binary operation satisfies the absorption condition: 0x=x0=00 \cdot x = x \cdot 0 = 0.

  • a quasigroup if one-sided multiplication by any element is a bijection.

A magma has a square root function :SS\sqrt{-}:S \to S if for all xSx \in S, xx=x\sqrt{x \cdot x} = x and xx=x\sqrt{x} \cdot \sqrt{x} = x.

The term ‘magma’ is from Bourbaki and is intended to suggest the fluidity of the concept; special cases include unital magmas, semigroups/monoids, quasigroups, groups, and so on. The term ‘groupoid’ is also used, but here that word means something else (see also related discussion at historical notes on quasigroups).

More generally, in any multicategory MM, a magma object or magma in MM is an object XX of MM equipped with a multimorphism m:X,XXm: X, X \to X in MM. Here the multimorphism from XX and XX to XX is a binary operation in MM. In particular, for MM a monoidal category, a magma structure on XX is a morphism m:XXXm\colon X \otimes X \to X, and in a closed category, a magma structure on XX is a morphism m:X[X,X]m\colon X \to [X, X].


Square function

Every magma (M,)(M,\cdot) has a morphism () 2:MM(-)^2:M \to M called the square and defined as x 2:=xxx^2 := x \cdot x for all xMx \in M.

Magmas as actions

An action of a set AA on another set BB is a function act:A×BBact:A \times B \to B. So this means that a magma is just an action of a set on itself.

Opposite magmas

There exists a function on the binary operation set B:(M×MM)(M×MM)B:(M\times M\to M)\to (M\times M\to M) called the braiding that takes every binary operation on the set to its opposite binary operation, where for every magma operation m:M×MMm:M\times M\to M and for all elements a,ba,b in MM, B(m)(a,b)=m(b,a)B(m)(a,b) = m(b,a). The set MM with the opposite binary operation is the opposite magma of MM. BB is an involution; the opposite of an opposite magma is the original magma itself; this follows from the fact that Set is a symmetric monoidal category. Fixed points of BB are called commutative binary operations.

Free magmas

The free magma on one generator (M,,1)(M, \cdot, 1) is a model of nesting parentheses around a magma, and is important in the study of higher category theory as composition of morphisms in (n,r)-categories and (infinity,n)-categories are not associative, but rather satisfy coherence laws such as the pentagon identity which relate the various ways to nest parentheses around the tensor product magma in an (infinity,n)-category with respect to homotopy equivalence. Many other higher categorical objects have coherence theorems which also deal with nested parentheses around a binary operation.

Extensional magmas

In foundations of mathematics such as intensional Martin-Loef dependent type theory, where functions do not preserve equality, one could distinguish between ordinary magmas as defined above, and extensional magmas, whose binary operation preserves equality.

For a magma (A,)(A, \cdot) and for all elements a,b,c:Aa, b, c:A, a magma is left extensional if a=ca = c implies ab=cba \cdot b = c \cdot b, and a magma is right extensional if a=ca = c implies ba=bcb \cdot a = b \cdot c. A magma is extensional if it is both left and right extensional.

algebraic structureoidification
pointed magma with an endofunctionsetoid/Bishop set
unital magmaunital magmoid
anti-involutive monoiddagger category
associative quasigroupassociative quasigroupoid
flexible magmaflexible magmoid
alternative magmaalternative magmoid
absorption monoidabsorption category
cancellative monoidcancellative category
rigCMon-enriched category
nonunital ringAb-enriched semicategory
nonassociative ringAb-enriched unital magmoid
nonassociative algebralinear magmoid
nonassociative unital algebraunital linear magmoid
nonunital algebralinear semicategory
associative unital algebralinear category
C-star algebraC-star category
differential algebradifferential algebroid
flexible algebraflexible linear magmoid
alternative algebraalternative linear magmoid
Lie algebraLie algebroid
monoidal poset2-poset
strict monoidal groupoid?strict (2,1)-category
strict 2-groupstrict 2-groupoid
strict monoidal categorystrict 2-category
monoidal groupoid(2,1)-category
monoidal category2-category/bicategory


On the history of the notion:

  • Christopher Hollings, The Early Development of the Algebraic Theory of Semigroups, Archive for History of Exact Sciences 63 (2009) 497–536 [doi:10.1007/s00407-009-0044-3]

The wikipedia entry magma is quite useful, having a list and a table of various subclasses of magmas, hence of binary algebraic structures.

  • eom: magma
  • R.H. Bruck, A survey of binary systems, Springer-Verlag 1958

Formalization of magmas as mathematical structures in proof assistants:

in a context of plain Agda:

in a context of cubical Agda:

category: algebra

Last revised on August 12, 2023 at 09:58:47. See the history of this page for a list of all contributions to it.