We can find the smallest examples using Mace4. You input the axioms "exists an identity element" and "each element has an inverse", and add the "goal" of proving associativity. Mace4 will find counter-examples.
This can be achieved by the following input:
formulas(sos).
e*x=x.
x*e=x.
x*x'=e.
x'*x=e.
end_of_list.
formulas(goals).
x*(y*z)=(x*y)*z.
end_of_list.
The output is the following on my computer (I snipped some of the output; there's quite a lot):
=== Mace4 starting on domain size 3. ===
============================== MODEL =================================
interpretation( 3, [number=1, seconds=0], [
function(e, [ 0 ]),
function(c1, [ 1 ]),
function(c2, [ 1 ]),
function(c3, [ 2 ]),
function('(_), [ 0, 1, 1 ]),
function(*(_,_), [
0, 1, 2,
1, 0, 0,
2, 0, 0 ])
]).
============================== end of model ==========================
The above says:
- an identity is $e=0$,
- associativity is violated by $c_1=1$, $c_2=1$ and $c_3=2$,
- an inversion is given by $0 \mapsto 0$, $1 \mapsto 1$ and $2 \mapsto 1$.
Modifications to the above input can yield interesting results, for example, there are $46$ non-associative binary operations on the set $\{0,1,2\}$ which admit an identity element, and for which each element has at least one inverse.