1 Basic theory of magmas
Definition
1.1
Magma
A magma is a set equipped with a binary operation . A homomorphism between two magmas is a map such that for all . An isomorphism is an invertible homomorphism.
Groups, semi-groups, and monoids are familiar examples of magmas. However, in general we do not expect magmas to have any associative properties. In some literature, magmas are also known as groupoids, although this term is also used for a slightly different object (a category with inverses).
A magma is called empty if it has cardinality zero, singleton if it has cardinality one, and non-trivial otherwise.
The number of magma structures on a set of cardinality is of course , which is
(OEIS A002489). Up to isomorphism, the number of finite magmas of cardinality up to isomorphism is the slightly slower growing sequence
(OEIS A001329).
Definition
1.2
Free Magma
The free magma generated by a set (which we call an alphabet) is the set of all finite formal expressions built from elements of and the operation . An element of will be called a word with alphabet . The order of a word is the number of symbols needed to generate the word. Thus for instance is precisely the set of words of order in .
For sake of concreteness, we will take the alphabet to default to the natural numbers if not otherwise specified.
For instance, if , then would consist of the following words:
, (the words of order );
, , , (the words of order );
, , , , , , , , , , , , , , , (the words of order );
etc.
Lemma
1.3
For a finite alphabet , the number of words of order is , where is the Catalan number and is the cardinality of .
Proof
▶
Follows from standard properties of Catalan numbers.
The first few Catalan numbers are
(OEIS A000108).
Definition
1.4
Induced homomorphism
Given a function from an alphabet to a magma , the induced homomorphism is the unique extension of to a magma homomorphism. Similarly, if is a function, we write for the unique extension of to a magma homomorphism.
For instance, if maps to respectively, then
and so forth. If is the map , then
and so forth.
Definition
1.5
Law
Let be a set. A law with alphabet is a formal expression of the form , where are words with alphabet (thus one can identify laws with alphabet with elements of ). A magma satisfies the law if we have for all , in which case we write .
Thus, for instance, the commutative law
is satisfied by a magma if and only if
for all . We refer to Equation 2 as the equation associated to the law Equation 1. One can think of equations as the “semantic” interpretation of a “syntactic” law. However, we shall often abuse notation and identify a law with its associated equation. In particular, we shall (somewhat carelessly) also refer to Equation 2 as “the commutative law” (rather than “the commutative equation”).
Definition
1.6
Models
A theory is a set of laws. Given a theory , a magma is a model of with the (overloaded) notation if for every in ; we also say that obeys . Given a law , we write if every magma that models , also models .
Definition
1.7
Derivation
Given a theory and a law over a fixed alphabet , we say that derives , and write , if the law can be obtained using a finite number of applications of the following rules:
if , then .
for any word .
if , then .
if and , then .
if , then for every .
if and , then .
This definition is useful because of the following theorem:
Theorem
1.8
Birkhoff’s completeness theorem
For any theory and words over a fixed alphabet
Proof
▶
(Sketch) The ‘only if’ component is soundness, and follows from verifying that the rules of inference in Definition 1.7 holds for . The ‘if’ part is completeness, and is proven by constructing the magma of words, quotiented out by the relation , which is easily seen to be an equivalence relation respecting the magma operation.
Corollary
1.9
Compactness theorem
Let be a theory, and let be a law. Then if and only if there exists a finite subset of such that .
Proof
▶
The claim is obvious for , and the claim then follows from Theorem 1.8.
Lemma
1.10
Pushforward
Let be a law with some alphabet , be a magma, and be a function. If , then . In particular, if is a bijection, the statements and are equivalent.
If is a bijection, we will call a relabeling of the law . Thus for instance
is a relabeling of the commutative law Equation 1. By the above lemma, relabeling does not affect whether a given magna satisfies a given law.
Lemma
1.11
Equivalence
Let be a magma and be an alphabet. Then the relation is an equivalence relation on .
Define the total order of a law to be the sum of the orders of and .
Lemma
1.12
Counting laws up to relabeling
Up to relabeling, the number of laws of total order is .
Proof
▶
Follows from the properties of Catalan and Bell numbers.
The first few Bell numbers are
(OEIS A000110).
The sequence in Lemma 1.12 is
(OEIS A289679).
Now we would also like to count laws up to relabeling and symmetry.
Lemma
1.13
Counting laws up to relabeling and symmetry
Up to relabeling and symmetry, the number of laws of total order is
when is odd, and
when is even, where is the number of partitions of up to reflection.
The sequence is
(OEIS A103293), and the sequence in Lemma 1.13 is
(OEIS A376620).
We can also identify all laws of the form with the trivial law . The number of such laws of total order is zero if is odd, and if is even. We conclude:
Lemma
1.14
Counting laws up to relabeling, symmetry, and triviality
Up to relabeling, symmetry, and triviality, the number of laws of total order is
if is odd, if , and
if is even.
This sequence is
(OEIS A376640).
In particular, up to relabeling, symmetry, and triviality, there are exactly laws of total order at most . A list can be found here. A script for generating them may be found here. The ordering of these equations is according to the following rules. First, an ordering on expressions with placeholder variables (such as ):
(i) Expressions of lower order come before expressions of higher order.
(ii) Expressions of a given total order that is at least one are ordered lexicographically first by the ordering on the left component , and then by the ordering on the right component if the left components agree.
For instance, is less than , which is less than .
Then, we order placeholder equations such as , where both sides are given placeholder variables:
(i) Equations of lower total order come before equations of higher total order.
(ii) Equations of a given total order are ordered lexicographically first by the ordering on the left-hand side , and then by the ordering on the right hand side if the left-hand sides agree.
For instance, is less than .
Finally, we order (and reduce) equations of the form as follows. Define the shape of an equation to be the equation in which all variables are replaced by placeholders .
(i) Equations of lower shape will be of lower order. For instance, any equation of shape is less than any equation .
(ii) Among equations of equations of equal shape, equations whose variables are first in the lexicographical ordering will be lower. For instance, is less than , which is in turn less than .
(iii) Only the arrangement of the equation (up to relabeling and symmetry) which is minimal in this ordering is retained in the list. For instance, we do not retain because it can be replaced by , which is earlier in the ordering.
(iv) Any trivial equation , other than the order zero law , is discarded.
1.0.1 Alternate formula
For integers let be the number of magma equations with of order , of order , counting up to relabelling, up to switching terms, and only allowing the equation of the form . Then one has
Here the Stirling numbers of the second kind count the number of ways to partition a set of elements into non-empty subsets,
counts the number of plane binary trees of order , and.
counts the number of idempotent bijections on elements.
The number of magma equations of order (under the given constraints) is then equal to
For further details, as well as Maple calculations for , see this folder.