I'm practicing proofs and would like to prove that the set of languages over an alphabet $\Sigma$ is a monoid regarding concatenation by showing that the following statements are true:
- There is a neutral element $E$, so that for all languages $A$ over $\Sigma$: $$A\circ{}E=E\circ{}A=A$$
- The concatenation is associative.
- The monoid is generally not commutative.
This is my suggested solution:
- Let $\epsilon$ be the empty string, $E=\lbrace{\epsilon}\rbrace$ and $A=\lbrace{u}\rbrace$ a language over $\Sigma$ with $u\in{}\Sigma^{*}$, so:
$$A\circ{}E=\lbrace{u}\rbrace\circ\lbrace{\epsilon}\rbrace=\lbrace{u}\rbrace=A=\lbrace{u}\rbrace=\lbrace{\epsilon}\rbrace\circ{}A=E\circ{}A$$
$\Rightarrow\epsilon$ is the neutral element.
- Let $A=\lbrace{u}\rbrace$, $B=\lbrace{v}\rbrace$, $C=\lbrace{w}\rbrace$ be languages over $\Sigma$ with $u,v,w\in{}\Sigma^{*}$, so:
$$(A\circ{}B)\circ{}C=(\lbrace{u}\rbrace\circ\lbrace{v}\rbrace)\circ\lbrace{w}\rbrace=\lbrace{uv}\rbrace\circ\lbrace{w}\rbrace=\lbrace{uvw}\rbrace=\lbrace{u}\rbrace\circ\lbrace{vw}\rbrace=\lbrace{u}\rbrace\circ(\lbrace{v}\rbrace\circ\lbrace{w}\rbrace)=A\circ{}(B\circ{}C)$$
$\Rightarrow$ The concatenation is associative and $(\Sigma^{*},\circ,\epsilon)$ is a monoid.
- Let $A=\lbrace{u}\rbrace$, $B=\lbrace{v}\rbrace$ be languages over $\Sigma$ with $u,v\in{}\Sigma^{*}$, so:
$$A\circ{}B=\lbrace{u}\rbrace\circ\lbrace{v}\rbrace=\lbrace{uv}\rbrace\neq\lbrace{vu}\rbrace=\lbrace{v}\rbrace\circ\lbrace{u}\rbrace=B\circ{}A$$
$\Rightarrow$ The concatenation is not commutative.
Is that a correct way to prove these three statements? If not, what would be the correct way?
It seems that everything works.
Just a remark: for non commutativity, you need your alphabet to have at least two different letters. Indeed, if $\Sigma = \{ a\}$ then you get a monoid isomorphic to $(\Bbb{N} , +)$ which is commutative.