design/tpl: Emphasize commutativity of monoids in classification system

master
Mike Gerwitz 2021-05-18 12:13:32 -04:00
parent 1ec0fc0c7b
commit 8a2407d66f
3 changed files with 27 additions and 9 deletions

View File

@ -96,8 +96,8 @@ $\alpha$~serves as a placeholder for an optional \xml{any="true"},
Note the wildcard variable matching \xmlattr{desc}---%
its purpose is only to provide documentation.
\begin{corollary}[$\odot$ Monoid]\corlabel{odot-monoid}
$\odot$ is a monoid in \axmref{class-intro}.
\begin{corollary}[$\odot$ Commutative Monoid]\corlabel{odot-monoid}
$\odot$ is a commutative monoid in \axmref{class-intro}.
\end{corollary}
\begin{proof}
By \axmref{class-intro},
@ -112,6 +112,15 @@ Note the wildcard variable matching \xmlattr{desc}---%
which is proved by \lemref{monoid-land}.
\end{proof}
\index{classification!commutativity}
\index{compiler!classification commutativity}
While \axmref{class-intro} seems to imply an ordering to matches,
users of the language are free to specify matches in any order
and the compiler will rearrange matches as it sees fit.
This is due to the commutativity of~$\odot$ as proved by
\corref{odot-monoid},
and not only affords great ease of use to users of~\tame{},
but also great flexibility to compiler writers.
\def\cpredmatseq{{M^0_j}_k \bullet\cdots\bullet {M^l_j}_k}

View File

@ -339,6 +339,12 @@ Given that, we have $f\bicomp{[]} = f\bicomp{[A]}$ for functions returning
\index{abstract algebra!semigroup}
Monoids originate from abstract algebra.
A monoid is a semigroup with an added identity element~$e$.
Only the identity element must be commutative,
but if the binary operation~$\bullet$ is \emph{also} commutative,
then the monoid is a \dfn{commutative monoid}.\footnote{%
A commutative monoid is less frequently referred to as an
\dfn{abelian monoid},
related to the common term \dfn{abelian group}.}
Consider some sequence of operations
$x_0 \bullet\cdots\bullet x_n \in S$.
@ -384,21 +390,21 @@ If $x=\Set{}$,
\index{conjunction!monoid}
\begin{lemma}\lemlabel{monoid-land}
$\Monoid\Bool\land\true$ is a monoid.
$\Monoid\Bool\land\true$ is a commutative monoid.
\end{lemma}
\begin{proof}
$\Monoid\Bool\land\true$ is associative by \dfnref{conj-assoc}.
The identity element is~$\true\in\Bool$ by \dfnref{conj-commut} and
\dfnref{conj-simpl},
as in $\true \land p \equiv p \land \true \equiv p$.
$\Monoid\Bool\land\true$ is associative by \dfnref{conj-assoc}
and commutative by \dfnref{conj-commut}.
The identity element is~$\true\in\Bool$ by \dfnref{conj-simpl}.
\end{proof}
\index{disjunction!monoid}
\begin{lemma}\lemlabel{monoid-lor}
$\Monoid\Bool\lor\false$ is a monoid.
$\Monoid\Bool\lor\false$ is a commutative monoid.
\end{lemma}
\begin{proof}
$\Monoid\Bool\lor\false$ is associative by \dfnref{disj-assoc}.
$\Monoid\Bool\lor\false$ is associative by \dfnref{disj-assoc}
and commutative by \dfnref{disj-commut}.
The identity $\false\in\Bool$ follows from
\begin{alignat*}{3}

View File

@ -140,6 +140,9 @@
\let\xml\texttt
% Definitions (introduction of terms)
\let\dfn\textsl
% Symbols appear at the beginning of the index
\newcommand\indexsym[2]{\index{__sym_#2@{\ensuremath{#1}}|see {#2}}}