What assumptions are needed to prove that $(ab)c=b(ac)$ implies commutativity & associativity? The question is in the title: I would like to know what extra assumptions (if any) are needed for the following derivation that $(a\cdot b)\cdot c=b\cdot(a\cdot c)$  implies commutativity, i.e. $a\cdot b=b\cdot a$, and associativity, i.e. $(a\cdot b)\cdot c=a\cdot (b\cdot c)$.
If I assume the existence of an identity satisfying $a\cdot1=a$ for all $a$ in consideration, then
$$a\cdot b=(a\cdot b)\cdot 1=b\cdot(a\cdot 1)=b\cdot a,$$
so we have commutativity, and given commutativity, we get
$$(a\cdot b)\cdot c=(b\cdot a)\cdot c=a\cdot(b\cdot c),$$
which is associativity.
Are there any structures with no identity element such that $(a\cdot b)\cdot c=b\cdot(a\cdot c)$ for all $a,b,c$, but the operation is not commutative? Can other axioms be used in place of an identity (like, say, a cancellation law $a\cdot c=b\cdot c\implies a=b$)?
 A: To expand on Martin Bradenburg’s comment : define recursively a
Carneiro expression on $\lbrace a,b \rbrace$ as follows :
1) $a$ and $b$ are themselves Carneiro expressions.
2) If $x$ and $y$ are Carneiro expressions, then $A(x,y)$ is a Carneiro
expression.
3) Any Carneiro expression can be obtained by applying operations
1 and 2 a finite number of times.
Thus, $A(A(A(a,b),a),A(A(a,a),A(b,b)))$ is an example of a Carneiro 
expression. Denote by $C(a,b)$ the set of all Carneiro expressions
on $\lbrace a,b \rbrace$. There is a unique map $d : C(a,b) \to {\mathbb N}$,
such that $d(a)=d(b)=1$ and $d(A(x,y))=1+{\sf max}(d(x),d(y))$ for any
$x,y\in C(a,b)$ : we call  $d(w)$ the depth of $w$, for a Carneiro expression
$w$.
Say that two Carneiro expressions $w_1$ and $w_2$ are elementarily equivalent if 
there are Carneiros expressions $x,y,z$ such that when we replace
$A(A(x,y),z)$ by $A(y,A(x,z))$ somewhere in the expansion of $w_1$ (or $w_2$),
then we obtain $w_2$ ($w_1$). Say that two Carneiro expressions $w_1$ and
$w_2$ are equivalent if there is a finite sequence starting with
$w_1$ and ending with $w_2$, such that each term in the sequence is 
elementarily equivalent to the next one. This is an equivalence relation, and
we will denote it by $\sim$.
Say that a Carneiro expression is reduced if if contains no subexpression of
the form $A(A(...,...),...)$. By induction on $d(w)$, any Carneiro expression
is equivalent to a unique reduced Carneiro expression, that we denote by
$r(w)$.
Let $R(a,b)$ denote the set of reduced Carneiro expressions on $\lbrace a,b \rbrace$.
Define a binary operation $*$ on $R(a,b)$ by $x*y=r(A(x,y))$ for $x,y\in R(a,b)$.
Then, by construction, this binary operation satisfies your axiom $(ab)c=a(bc)$, 
also satisfies cancellation, but is not commutative
(indeed $a*b \neq b*a$) nor associative (indeed $(a*b)*a$ and $a*(b*a)$ are not equal,
since the first one computes to $A(b,A(a,a))$ and the other computes to $A(a,A(b,a))$. )
A: Consider matrices with even entries modulo $8$. Any product of three such matrices is zero, but we do not have commutativity.
