Kleene Closure is Monoid

Theorem
Let $S$ be a set, and let $S^*$ be its Kleene closure.

Let $*$ denote concatenation of ordered tuples.

Then $\left({S^*, *}\right)$ is a monoid.

Proof
First, to prove that $\left({S^*, *}\right)$ is a semigroup.

That is, to prove $*$ is associative.

Let $s, s', s \in S^*$ be sequences of lengths $n, n', n$, respectively.

Then:

Hence, by Equality of Mappings:


 * $s * \left({s' * s}\right) = \left({s * s'}\right) * s$

that is, $*$ is associative.

Now, to prove $\left({S^*, *}\right)$ has an identity $e$.

It follows immediately from the length of a concatenation that $e$ must have length $0$.

That is, the only choice for $e$ is the empty sequence.

Now, for any $s \in S^*$:


 * $e * s \left({i}\right) = \begin{cases}e \left({i}\right) & \text{if $1 \le i \le 0$} \\s \left({i}\right) & \text{if $0 < i < 0 + n$}\end{cases}$

from which we see that $e * s = s$.

Also:


 * $s * e \left({i}\right) = \begin{cases}s \left({i}\right) & \text{if $1 \le i \le n$} \\e \left({i}\right) & \text{if $n < i < n + 0$}\end{cases}$

which shows $s * e = s$.

So indeed the empty sequence is an identity element of $\left({S^*, *}\right)$.

Hence $\left({S^*, *}\right)$ is a monoid.