Suppose we have a set $S=\{a,b\}.$ Obviously, the total number of binary operations on $S$ is the number of all the pairs such that $$*(a,b)=a \, \text{or} \, b,$$ which gives $ 2 \cdot 2 \cdot 2 \cdot 2=2^4$ possible ones. Is there a way to find which of these $16$ binary operations are associative without writing all the operation matrices and checking it by hand?
-
1Do you want to find all of the associative operations, or do you just want to know them up to isomorphism? – Travis Willse Nov 01 '18 at 18:51
-
I want to find all the associative ones to determine which of these consist a group with $S$. – Andrew Nov 01 '18 at 18:56
-
1If you're interested in determining which are groups, you can simplify the process considerably using the other group axioms. Would you be content with an answer that did so? – Travis Willse Nov 01 '18 at 19:01
-
I'm curious about the associativity alone, if you don't mind. Is it difficult? – Andrew Nov 01 '18 at 19:19
-
Not difficult, no, just longer. – Travis Willse Nov 01 '18 at 19:32
-
So, is it only doable by hand? I mean, there's no rule to follow to find which are associative, like the one for commutative ones (symmetric matrix) ? – Andrew Nov 01 '18 at 20:11
-
There's no rule nearly for discerning associativity from the Cayley table of an operation that's anywhere near as nice as commutativity $\leftrightarrow$ symmetry. As I mention in my just-posted answer, one can improve on the brute-force method. See: https://en.wikipedia.org/wiki/Light%27s_associativity_test – Travis Willse Nov 01 '18 at 20:32
-
Since $n$ is small one can do this efficiently using ad hoc methods like I do in my answer, but this approach rapidly becomes untenable. Already for $n = 3$ there are $19,683$ operations, and these fall into $3,330$ isomorphism classes, of which only $24$ are associative. – Travis Willse Nov 01 '18 at 20:40
-
1@Travis A023814 for associative operations on $n$ labelled elements, A027851 for isomorphism types of semigroups. – bof Nov 01 '18 at 22:57
-
@bof Thank you, I was unaware of these entries! – Travis Willse Nov 02 '18 at 00:17
3 Answers
As YCord points out, we can restate the question as:
What are the semigroup structures $\ast$ on a set of two elements?
There are few enough operations on two elements that we can carry out the analysis manually without too much effort.
An efficient way to approach the problem is to split cases according to whether the elements of the set, say, $a, b$, are idempotent.
Case I: Both elements are idempotent If both elements are idempotent, so that $a^2 = a$ and $b^2 = b$, it remains to define $ab, ba$.
- If $ab = ba$, then by relabeling we can assume $ab = ba = a$. Then, under the relabeling $a \rightsquigarrow 0, b \rightsquigarrow 1$, $\ast$ is the logical operation $$\textsf{AND}.$$
- If $ab = a, ba = b$, the operation is $$\textsf{L} : (x, y) \mapsto x .$$
- If $ab = b, ba = a$, the operation is $$\textsf{R} : (x, y) \mapsto y .$$ (Checking directly shows that all of these operations are associative.)
Case II: Some element is not idempotent If there is an element that is not idempotent, by relabeling we may assume it is $b$, so that the elements of the set are are $b, b^2$. I'll leave the rest of this case as an exercise for the reader.
Allowing for relabeling $a \leftrightarrow b$, we see that $$\color{#df0000}{\boxed{\textrm{there are $8$ associative operations on a set of two elements}}} .$$ We record these operations below. The bijection exchanging $a \leftrightarrow b$ induces dualities among some of them, leaving $5$ operations up to isomorphism. For convenience in identifying them with familiar logical operators, as above we relabel the elements by $\{0, 1\}$.
- The constant operation $\textsf{0}$ is dual to the constant operation $\textsf{1} : (x, y) \mapsto 1$.
- The operation $\textsf{AND}$ is dual to $\textsf{OR}$.
- The operation $\textsf{XOR}$ is dual to $\textsf{XNOR}$.
- The operation $\textsf{L}$ is self-dual (dual to itself).
- The operation $\textsf{R}$ is self-dual.

- 99,363
This is called semigroup.
Let's classify semigroups on 2 elements up to isomorphism/ skew-isomorphism, and determine their group of automorphisms.
1) If it's monogeneous, then it's commutative. Let $x$ be a generator: then $x^2=y$, and $xy=yx=x^3$, $y^2=x^4$.
1a) Group: If $xy=yx=x$, then $x^3=x$, hence $y^2=x^4=x^2=y$: this is the group law (with unit $y$). Its group of automorphisms is trivial (it fixes the unit $y$).
1b) Constant: If $xy=yx=y$, then $x^3=y$, hence $x^4=xy=y$: the law is constant equal to $y$. Its group of automorphisms is trivial (it fixes the absorbing element $y$).
2) If it's not monogeneous, then $x^2=x$ and $y^2=y$. Up to flip, we can suppose that $xy=x$.
2a) Min: If $yx=x$, then we have the min law on the ordered set $x<y$, also commutative. Its group of automorphisms is trivial.
2b) Projection: If $yx=y$, we have the non-commutative law $ab=b$. The transposition is an automorphism.
Each of 1a, 1b, 2a being commutative with trivial automorphism group, it comes with the law conjugated by the transposition, which is obvious to describe in each case. The law of 2b being non-commutative with automorphism group of 2 elements, it also comes with the reverse law, which in this case is obvious to describe as well (but is not isomorphic).
Total, this gives 8 associative laws on the set of 2 elements, out of the 16 binary operations. These are 5 up to isomorphism (and 4 up to isomorphism/ skew-isomorphism).
The only binary laws on 2 elements with a unit are associative (thus monoid laws), and are commutative: these are the group law (1a) and (2a).
Just for fun, I counted the isomorphism types in the remaining 8 non-associative operations. Since all non-monogeneous ones are associative, the non-associative ones all monogeneous, hence they are not power-associative. In each case we can discuss if it's (left) self-distributive or a (left) rack (i.e., satisfies $t(uv)=(tu)(tv)$), or idem on the right, i.e. if the reversed law has the left property. Note that left self-distributive rack means that left multiplications $L_u$ are endomorphisms. Here I use the notation $L_u(v)=uv=R_v(u)$. I denote by $\tau$ the transposition of the 2-element set, and $c_u$ the constant map equal to $u$; it is an endomorphism if and only if $u^2=u$.
3) One has a commutative one: $xy=yx=x$, $x^2=y$, $y^2=x$. Of course the identity $t(tt)=(tt)t$ holds by commutativity, but the identity $(tt)(tt)=t(t(tt))$ fails with both $t=x$ and $t=y$. It comes with the law conjugated by transposition. It's not self-distributive (neither $L_x=\tau$ nor $L_y=c_x$ is an endomorphism).
4) On has the non-commutative law $xy=y^2=x$, $x^2=yx=y$ (in short, $ab=\tau(b)$). Here the identity $t(tt)=(tt)t$ fails with both $x$ and $y$. The transposition $\tau$ is an automorphism. Denoting $L_u(v)=uv=R_v(u)$, we have $L_x=L_y=\tau$, and in particular this is a (left) rack. It is not right self-distributive (neither $R_x=c_y$ nor $R_y=c_x$ is an endomorphism). It comes with the skew law (which is thus a right rack).
5) One has the non-commutative law $x^2=yx=y^2=x$, $xy=y$. The transposition $\tau$ is neither an automorphism, nor a skew-automorphism. Hence it comes with the reverse law, and their conjugate by $\tau$ (which together yield 4 binary operations). One has $L_x=\mathrm{id}$, $L_y=c_x$ (constant $x$), $R_x=c_x$, $R_y=\tau$. Since $x$ is idempotent, $c_x$ is an endomorphism, and hence this is (left) self-distributive, but is not a left rack. It is not right self-distributive, as $R_y=\tau$.
Among the associative laws, the group one (1a) is not self-distributive. All others (1b), (2a), (2b) are both left and right self-distributive. Those of (1b), (2a) are not racks ($L_y=c_y$ in both). The one of (2b) has $L_x=L_y=\mathrm{id}$, and $R_x=c_x$, $R_y=c_y$: it is a left rack but not a right rack. It is even a left quandle (a quandle is a rack satisfying the identity $t^2=t$) (All these facts about (2b) applies more generally to the law $ab=b$ on an arbitrary set with $\ge 2$ elements.)
Hence, on a set of 2 elements, among the 16 binary operations, 9 are left self-distributive (both in 1b, 2a, 2b, the given one in 4, and the given one in 5 as well as its conjugate by $\tau$). Only 2 are left racks: the given one in 2b and in 4. Note that the latter two are "opposite", i.e., the one of 2b is $ab=b$, while the one in 4 is $ab=\tau(b)$.

- 17,878
Suppose $ab \ne ba$.
Let $c = b$ or $a$ and $d = a$ or $b$ respectively so that $cd =c$ and $dc = d$.
Then $c(dc) = cd =c$ and $(cd)c =cc$ which are only equal if $cc =c$
Then $d(cd) = dc = d$ and $(dc)d= dd$ where are only equal if $dd = d$.
So this is $xy = x$ so $x(yz) = xy =x$ and $(xy)z=xz =x$.
So we have:
$aa=a; ab=a; ba=b;bb=b$ is associative but:
$aa=a; ab=a;ba=b; bb=a$ and $aa=b;ab=a;ba=b; bb=a;$ and $aa=b;ab=a;ba=b; bb=b$ are not.
If instead we had $cd =d$ and $dc = c$ then
$c(dc) = cc$ and $(cd)c = dc=c$ which are equal only if $cc=c$.
And $d(cd) = dd$ and $(dc)d=cd=d$ where are equal only if $dd =d$.
So this is $xy =y$ so $x(yz) = yz =z$ and $(xy)z = yz = z$.
So we have
$aa=a; ab=b; ba=a;bb=b$ is associative but:
$aa=a; ab=b;ba=a; bb=a$ and $aa=b;ab=a;ba=b; bb=a;$ and $aa=b;ab=a;ba=b; bb=b$ are not.
Now suppose $ab = ba$.
Let $c = b$ or $a$ and $d = a$ or $b$ respectively so that $cd =c$ and $dc = c$.
$c(dc) = cd = c$ and $(cd)c = cc$ which are equal only if $cc = c$.
So this is either i)$dd =c$ and $xy = c$ for all $x,y$. Or ii) $dd =d$ and $xy =d \iff x=y=d$ .
i) $x(yz)= xc=c$ and $(xy)z= cz =c$ so Associative.
ii) $x(yz)=d \iff x=y=z = d \iff (xy)z = d$
So $x(yz)=c \iff x(yz) \ne d \iff (xy)z \ne d \iff (xy)z = c$.
So we have:
$aa = a; ab=a; ba=a;bb=a$ and $aa=a; ab=a; ba=a; bb=b$ and $aa=a; ab=b;ba=b; bb=b$ and $aa=b; ab=b; ba=b; bb=b$ are associative but:
$aa=b; ab=a; ba=a;bb=a$ and $aa=b; ab=a; ba=a;bb=b$ and $aa=b; ab=b; ba=b;bb=a$ and $aa=b; ab=b; ba=b;bb=a$are not.
So we have $6$ are associative but $10$ are not.

- 124,253
-
I think there are some errors here. For example, in the third-to-last operation, which is identified as nonassociative, rewriting using the identifications $a \leftrightarrow 1$, $b \leftrightarrow 0$ and using the symbol $+$ to denote the operation gives $0 + 0 = 1 + 1 = 0$, $0 + 1 = 1 + 0 = 0$. But this is just addition modulo $2$, which is certainly associative. – Travis Willse Nov 02 '18 at 00:33
-