Full transformation monoid (source code)

= Full transformation monoid
{title2=$T_X=X^X$}

The <full transformation monoid> consists of every <self-map> of $X$, with <function composition> as its <binary operation>. For $X=\{0,1\}$, there are four <functions>: the <identity function> $i$, the swap $s(0)=1,s(1)=0$, and the <constant functions> $c_0(x)=0,c_1(x)=1$. Their composition order matters: $c_0\circ s=c_0$, whereas $s\circ c_0=c_1$. Thus <associativity> does not imply <commutativity>.

\Image[/two-point-transformation-monoid.png]
{title=Four <self-maps> of $\{0,1\}$ form a <full transformation monoid>}
{description=The arrow diagrams show each <function>. The <Cayley table> reads row $f$, column $g$ as $f\circ g$, applying $g$ first. Only $i$ and $s$ have <inverse elements>. The <constant functions> lose information and satisfy <idempotence>.}

Only $i$ and $s$ are <bijections>, and their <inverse elements> are themselves. They form a two-element <group> within this <monoid>. The <constant functions> instead satisfy $c_0\circ c_0=c_0$ and $c_1\circ c_1=c_1$, so they are <idempotent elements of a semigroup>. Such irreversible transformations explain why the <monoid> setting is useful even when a <group> would be too restrictive.