Any set with Associativity, Left Identity, Left Inverse, is a Group. - Fraleigh p.49 4.38

$$\begin{align}a\cdot e &= e\cdot(a\cdot e)&\text{ a left identity is all I have at our disposal}\\ &=(\color{darkcyan}{e}\cdot a)\cdot e&\text{associativity is the only apparent option}\\ &=(\color{darkcyan}{(x^{-1}\cdot x)}\cdot a)\cdot e&\text{let's introduce something new for $e$, maybe later pick a nice $x$}\\ &=(\color{magenta}{x}^{-1}\cdot(\color{magenta}x\cdot a))\cdot e&\text{again, what else but associativity is possible?}\\ &=???&\text{IDEA! If $x$ happens to be $a^{-1}$, we can continue}\\ &=(\color{magenta}{(a^{-1})}^{-1}\cdot(\color{magenta}{a^{-1}}\cdot a))\cdot e&\text{... like this}\\ &=((a^{-1})^{-1}\cdot e)\cdot e&\text{ so that some expressions cacel}\\ &=(a^{-1})^{-1}\cdot (e\cdot e)&\text{associativity, what else?}\\ &=(a^{-1})^{-1}\cdot e&\text{now use the $e$ is left neutral - gee, the last two steps in effect ...}\\ &=(a^{-1})^{-1}\cdot(a^{-1}\cdot a)&\text{got rid of an $e$ on the right! So lets undo all steps until that point}\\ &=((a^{-1})^{-1}\cdot a^{-1})\cdot a\\ &=e\cdot a\\ &=a\end{align} $$


There are two key points behind the tricky algebra that you want to prognosticate. Both come from the fact that groups were abstracted from the study of actions, and that most of the constructions in group theory are really special cases of constructions from group actions (in fact, normal subgroups were defined in terms of group actions before abstract groups themselves were even defined).

The first key point is that the inverse of an inverse of a thing should behave like the original thing, since undoing an action and the undoing that, should result in just doing the action. Formally, the relevant definitions are the following.

A magma is a set $M$ together with a binary operation, i.e. a function $M\times M\to M$ (which I will denote by juxtaposition: $(m_1,m_2)\mapsto m_1m_2$). An action of a magma $M$ on a set $X$, (also called an $M$-set) is a two-variable function $M\times X\to X$ (denoted by $(m,x)\mapsto m\cdot x$) and satisfying the axiom $(m_1m_2)\cdot x=m_1\cdot(m_2\cdot x)$. The intuition here is supposed to be that the elements of the magma "move around" the elements of the set in a certain specified way.

One of the most important constructions in the theory of actions is that of the the stabilizer of an element $x$ of an $M$-set $X$. Concretely, the stabilizer $\DeclareMathOperator{\Stab}{Stab}\Stab(x)$ of $x\in X$ (for a magma action $M\times X\to X$) is defined as $\Stab(x)=\{m\in M\colon m\cdot x=x\}$ (side-note: $\Stab(x)$ is a "sub-magma": if $m_1,m_2\in\Stab(x)$, then $m_1m_2\in\Stab(x)$).

With this out of the way, we can now say what it means for $m'$ to be an inverse to $m$, relative to a magma-action $M\times X\to X$. It means that $m'm\in\Stab(x)$ for every $x$ (i.e. $(m'm)\cdot x=m'\cdot(m\cdot x)=x$). Similarly, an element $e$ is an identity for the action if $e\in\Stab(x)$ for every $x$, i.e. $e\cdot x=x$.

The key point behind the algebra that you wish to prognosticate is then the following. If $m''$ is an inverse for $m'$, and $m'$ is an inverse for $m$, then since $m''$ is supposed to be undoing what $m'$ is doing, and $m'$ is undoing what $m$ is doing, $m''$ should be doing what $m$ is doing. In equations, $m''\cdot x=m''\cdot (m'\cdot(m\cdot x))=(m''m')\cdot(m\cdot x)=m\cdot x$ for every $x\in X$. In particular, since $m''$ is an inverse of $m'$, $m$ should also be an inverse of $m'$, and it is: replacing $x$ with $m'\cdot x$ above reveals that $x=(m''m')\cdot x=m''\cdot(m' x)=(mm')\cdot x$ so that $m$ is indeed an inverse (i.e. $mm'$ is an identity).


The second key point is that a group acts on itself in two ways: on the left, and on the right, and that inverses allow you to transfer information from one side of the action to the other.

A magma is called a semi-group if the binary operation is associative, i.e. $(m_1m_2)m_3=m_1(m_2m_3)$. This is the same as requiring that the binary operation of the magma is itself an action of the magma on itself, i.e. if we set $m_1\cdot m_2:=m_1m_2$, associativity says that $(m_1m_2)\cdot m_3=m_1\cdot(m_2m_3)$. Let me repeat: associativity of the binary operation corresponds to the algebraic structure acting on itself via the binary operation.

A semi-group is called a monoid if there is an element $e\in M$ such that $em=m=me$ for every $m\in M$. We call such an $e$ a two-sided identity, while a left-sided identity is any element $e$ satisfying $em=m$ for every $m\in M$, i.e. if $e\in\Stab(m)$ for every $m\in M$, so an identity for the action of $M$ on itself. We can't, however, easily express the idea that $e$ is a right-identity, i.e. that $me=m$ for every $m\in M$ using the obvious action of $M$ on itself. What is missing here is the that a semi-group also has a contravariant action on itself. A contravariant action $M\times X\to X$ satisfies $(m_1 m_2)\cdot x=m_2\cdot(m_1\cdot x)$ (whereas a usual (covariant) action satisfies $(m_1m_2)\cdot x=m_1\cdot(m_2\cdot x))$. For a semi-group associativity says not only that $m_1\cdot_l m_2:=m_1m_2$ defines an action of $M$ on itself, but that $m_1\cdot_{r}m_2:=m_2m_1$ defines a contravariant action (side-note: a semi-group is commutative, i.e. $m_1m_2=m_2m_1$ if and only if the left- and right-actions $\cdot_l$ and $\cdot_r$ are the same action).

To summarize, a semi-group is a magma $M$ with an associative operation, which automatically implies that $M$ acts on itself in two ways: on the left and on the right. A left-identity is an identity for the left-action, a right-identity is an identity for the right-action, a left-inverse is an inverse for the left-action, and a right-inverse is an inverse for the right-action.

Now, it is easy to see how inversion relates the left- and right-actions. If $m_1'$ and $m_2'$ are left-inverses for $m_1$ and $m_2$, then $m_1'm_2'$ is a left-inverse for $m_2m_1$. Furthermore, the left-inverse of any element of $\Stab_l(m)$ also has to be in $\Stab_l(m)$. This implies that the inverses of elements in $\Stab_l(m)$ are all contained in $\Stab_r(m')$ for $m'$ a left-inverse of $m$. Finally, since a left-identity is tautologically its own left-inverse, it follows that any left-identity is already contained in the right-stabilizer of any left-inverse.

Thus, it is enough to show that every element of $M$ is a left-inverse, which from the first key point would follow from knowing that any left-inverse has a left-inverse, which is implied by requiring every element to have a left-inverse. Thus, any left-identity is a right-identity, and every element is both a left and a right-inverse.