2021-05-19 09:55:54 -04:00
|
|
|
|
% The TAME Programming Language Classification System
|
|
|
|
|
%
|
2023-01-17 23:09:25 -05:00
|
|
|
|
% Copyright (C) 2021 Ryan Specialty, LLC.
|
2021-05-19 09:55:54 -04:00
|
|
|
|
%
|
|
|
|
|
% Licensed under the Creative Commons Attribution-ShareAlike 4.0
|
|
|
|
|
% International License.
|
|
|
|
|
%%
|
2021-04-30 09:16:01 -04:00
|
|
|
|
|
|
|
|
|
\section{Classification System}\seclabel{class}
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\index{classification|textbf}
|
2021-05-18 12:16:11 -04:00
|
|
|
|
A \dfn{classification} is a user-defined abstraction that describes
|
2021-04-30 09:16:01 -04:00
|
|
|
|
(``classifies'') arbitrary data.
|
|
|
|
|
Classifications can be used as predicates, generating functions, and can be
|
|
|
|
|
composed into more complex classifications.
|
|
|
|
|
Nearly all conditions in \tame{} are specified using classifications.
|
|
|
|
|
|
|
|
|
|
\index{first-order logic!sentence}
|
|
|
|
|
\index{classification!coupling}
|
2021-05-18 12:16:11 -04:00
|
|
|
|
All classifications represent \dfn{first-order sentences}---%
|
2021-04-30 09:16:01 -04:00
|
|
|
|
that is,
|
2021-05-18 12:16:11 -04:00
|
|
|
|
they contain no \dfn{free variables}.
|
2021-04-30 09:16:01 -04:00
|
|
|
|
Intuitively,
|
|
|
|
|
this means that all variables within a~classification are
|
2021-05-18 12:16:11 -04:00
|
|
|
|
\dfn{tightly coupled} to the classification itself.
|
2021-04-30 09:16:01 -04:00
|
|
|
|
This limitation is mitigated through use of the template system.
|
|
|
|
|
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\begin{axiom}[Classification Introduction]\axmlabel{class-intro}
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\indexsym\Classify{classification}
|
|
|
|
|
\indexsym\gamma{classification, yield}
|
|
|
|
|
\index{classification!index set}
|
|
|
|
|
\index{index set!classification}
|
|
|
|
|
\index{classification!classify@\xmlnode{classify}}
|
|
|
|
|
\index{classification!as@\xmlattr{as}}
|
|
|
|
|
\index{classification!yields@\xmlattr{yields}}
|
2021-05-14 12:05:17 -04:00
|
|
|
|
\todo{Symbol in place of $=$ here ($\equiv$ not appropriate).}
|
2021-05-20 15:22:06 -04:00
|
|
|
|
\begin{subequations}
|
|
|
|
|
\begin{gather}
|
|
|
|
|
\begin{alignedat}{3}
|
2021-05-14 12:05:17 -04:00
|
|
|
|
&\xml{<classify as="$c$" }&&\xml{yields="$\gamma$" desc}&&\xml{="$\_$"
|
|
|
|
|
$\alpha$>}\label{eq:xml-classify} \\
|
2021-05-20 15:22:06 -04:00
|
|
|
|
&\quad \MFam{M^0}jJkK &&\VFam{v^0}jJ &&\quad s^0 \\[-4mm]
|
|
|
|
|
&\quad \quad\vdots &&\quad\vdots &&\quad \vdots \\
|
|
|
|
|
&\quad \MFam{M^l}jJkK &&\VFam{v^m}jJ &&\quad s^n \\[-3mm]
|
2021-05-14 12:05:17 -04:00
|
|
|
|
&\xml{</classify>}
|
|
|
|
|
% NB: This -50mu needs adjustment if you change the alignment above!
|
2021-05-20 15:22:06 -04:00
|
|
|
|
&&\mspace{-50mu}= \Classify^c_\gamma\left(\odot,M,v,s\right),
|
|
|
|
|
\end{alignedat}
|
|
|
|
|
\end{gather}
|
2021-05-14 12:05:17 -04:00
|
|
|
|
|
|
|
|
|
\noindent
|
|
|
|
|
where
|
|
|
|
|
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\indexsym\emptystr{empty string}
|
|
|
|
|
\index{empty string (\ensuremath\emptystr)}
|
2021-05-14 12:05:17 -04:00
|
|
|
|
\begin{align}
|
2021-05-18 10:06:32 -04:00
|
|
|
|
J &\subset\Int \neq\emptyset, \\
|
|
|
|
|
\forall{j\in J}\Big(K_j &\subset\Int \neq\emptyset\Big), \\
|
2021-05-19 09:02:48 -04:00
|
|
|
|
\forall{k}\Big(M^k &: J \rightarrow K_{j\in J} \rightarrow \Bool\Big),
|
2021-05-14 12:05:17 -04:00
|
|
|
|
\label{eq:class-matrix} \\
|
2021-05-19 09:02:48 -04:00
|
|
|
|
\forall{k}\Big(v^k &: J \rightarrow \Bool\Big), \\
|
|
|
|
|
\forall{k}\Big(s^k &\in\Bool\Big), \\
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\alpha &\in\Set{\emptystr,\, \texttt{any="true"}}, \label{eq:xml-any-domain}
|
2021-05-14 12:05:17 -04:00
|
|
|
|
\end{align}
|
|
|
|
|
|
|
|
|
|
\noindent
|
|
|
|
|
and the monoid~$\odot$ is defined as
|
|
|
|
|
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\indexsym\odot{classification, monoid}
|
|
|
|
|
\index{classification!any@\xmlattr{any}}
|
|
|
|
|
\index{classification!monoid|(}
|
2021-05-14 12:05:17 -04:00
|
|
|
|
\begin{equation}\label{eq:classify-rel}
|
|
|
|
|
\odot = \begin{cases}
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\Monoid\Bool\land\true &\alpha = \emptystr,\\
|
2021-05-14 12:05:17 -04:00
|
|
|
|
\Monoid\Bool\lor\false &\alpha = \texttt{any="true"}.
|
|
|
|
|
\end{cases}
|
|
|
|
|
\end{equation}
|
2021-05-20 15:22:06 -04:00
|
|
|
|
\end{subequations}
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\end{axiom}
|
2021-05-14 12:05:17 -04:00
|
|
|
|
|
|
|
|
|
|
2021-05-18 10:06:32 -04:00
|
|
|
|
% This TODO was the initial motivation for this paper!
|
|
|
|
|
\todo{Emphasize index sets, both relationships and nonempty.}
|
2021-05-14 12:05:17 -04:00
|
|
|
|
We use a $4$-tuple $\Classify\left(\odot,M,v,s\right)$ to represent a
|
|
|
|
|
$\odot_1$-classification
|
|
|
|
|
(a classification with the binary operation $\land$ or~$\lor$)
|
|
|
|
|
consisting of a combination of matrix~($M$), vector~($v$), and
|
|
|
|
|
scalar~($s$) matches,
|
|
|
|
|
rendered above in columns.\footnote{%
|
|
|
|
|
The symbol~$\odot$ was chosen since the binary operation for a monoid
|
2021-05-26 10:38:36 -04:00
|
|
|
|
is~$\monoidop$
|
2021-05-14 12:05:17 -04:00
|
|
|
|
(see \secref{monoids})
|
2021-05-26 10:38:36 -04:00
|
|
|
|
and~$\odot$ looks vaguely like~$(\monoidop)$,
|
2021-05-14 12:05:17 -04:00
|
|
|
|
representing a portion of the monoid triple.}
|
|
|
|
|
A $\land$-classification is pronounced ``conjunctive classification'',
|
|
|
|
|
and $\lor$ ``disjunctive''.\footnote{%
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\index{classification!terminology history}
|
2021-05-11 16:37:08 -04:00
|
|
|
|
Conjunctive and disjunctive classifications used to be referred to,
|
|
|
|
|
respectively,
|
2021-05-18 12:16:11 -04:00
|
|
|
|
as \dfn{universal} and \dfn{existential},
|
2021-05-11 16:37:08 -04:00
|
|
|
|
referring to fact that
|
2021-05-13 15:50:13 -04:00
|
|
|
|
$\forall\Set{a_0,\ldots,a_n}(a) \equiv a_0\land\ldots\land a_n$,
|
2021-05-11 16:37:08 -04:00
|
|
|
|
and similarly for $\exists$.
|
|
|
|
|
This terminology has changed since all classifications are in fact
|
|
|
|
|
existential over their matches' index sets,
|
2021-05-14 12:05:17 -04:00
|
|
|
|
and so the terminology would otherwise lead to confusion.}
|
|
|
|
|
|
|
|
|
|
The variables~$c$ and~$\gamma$ are required in~\tame{} but are both optional
|
|
|
|
|
in our notation~$\Classify^c_\gamma$,
|
|
|
|
|
and can be used to identify the two different data representations of
|
|
|
|
|
the classification.\footnote{%
|
|
|
|
|
\xpath{classify/@yields} is optional in the grammar of \tame{},
|
|
|
|
|
but the compiler will generate one for us if one is not provided.
|
|
|
|
|
As such,
|
|
|
|
|
we will for simplicity consider it to be required here.}
|
|
|
|
|
|
|
|
|
|
$\alpha$~serves as a placeholder for an optional \xml{any="true"},
|
|
|
|
|
with $\emptystr$~representing the empty string in~\eqref{eq:xml-any-domain}.
|
|
|
|
|
Note the wildcard variable matching \xmlattr{desc}---%
|
|
|
|
|
its purpose is only to provide documentation.
|
|
|
|
|
|
2021-05-18 12:13:32 -04:00
|
|
|
|
\begin{corollary}[$\odot$ Commutative Monoid]\corlabel{odot-monoid}
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\index{classification!commutativity|(}
|
2021-05-18 12:13:32 -04:00
|
|
|
|
$\odot$ is a commutative monoid in \axmref{class-intro}.
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\end{corollary}
|
|
|
|
|
\begin{proof}
|
|
|
|
|
By \axmref{class-intro},
|
|
|
|
|
$\odot$ must be a monoid.
|
2021-05-19 10:48:35 -04:00
|
|
|
|
Assume $\alpha=\emptystr$.
|
2021-05-18 10:06:32 -04:00
|
|
|
|
Then,
|
|
|
|
|
$\odot = \Monoid\Bool\land\true$,
|
|
|
|
|
which is proved by \lemref{monoid-land}.
|
|
|
|
|
Next, assume $\alpha=\texttt{any="true"}$.
|
|
|
|
|
Then,
|
|
|
|
|
$\odot = \Monoid\Bool\lor\false$,
|
|
|
|
|
which is proved by \lemref{monoid-land}.
|
|
|
|
|
\end{proof}
|
|
|
|
|
|
2021-05-18 12:13:32 -04:00
|
|
|
|
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.
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\index{compiler!classification commutativity}
|
2021-05-18 12:13:32 -04:00
|
|
|
|
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.
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\index{classification!commutativity|)}
|
2021-05-18 10:06:32 -04:00
|
|
|
|
|
2021-05-18 14:09:27 -04:00
|
|
|
|
For notational convenience,
|
|
|
|
|
we will let
|
|
|
|
|
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\index{classification!monoid|)}
|
2021-05-20 15:22:06 -04:00
|
|
|
|
\begin{equation}
|
|
|
|
|
\begin{aligned}
|
2021-05-25 10:50:55 -04:00
|
|
|
|
\Classifyland(M,v,s)
|
|
|
|
|
&= \Classify\left(\Monoid\Bool\land\true,M,v,s\right), \\
|
|
|
|
|
\Classifylor(M,v,s)
|
|
|
|
|
&= \Classify\left(\Monoid\Bool\lor\true,M,v,s\right). \\
|
2021-05-20 15:22:06 -04:00
|
|
|
|
\end{aligned}
|
|
|
|
|
\end{equation}
|
2021-05-18 14:09:27 -04:00
|
|
|
|
|
2021-05-18 10:06:32 -04:00
|
|
|
|
|
2021-05-26 10:38:36 -04:00
|
|
|
|
\def\cpredmatseq{{M^0_j}_k \monoidops {M^l_j}_k}
|
|
|
|
|
\def\cpredvecseq{v^0_j\monoidops v^m_j}
|
|
|
|
|
\def\cpredscalarseq{s^0\monoidops s^n}
|
2021-05-14 12:05:17 -04:00
|
|
|
|
|
2021-05-18 10:06:32 -04:00
|
|
|
|
|
|
|
|
|
\begin{axiom}[Classification-Predicate Equivalence]\axmlabel{class-pred}
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\index{classification!as predicate}
|
2021-05-26 10:38:36 -04:00
|
|
|
|
Let $\Classify^c_\gamma\left(\Monoid\Bool\monoidop e,M,v,s\right)$ be a
|
2021-05-18 10:06:32 -04:00
|
|
|
|
classification by~\axmref{class-intro}.
|
2021-05-14 12:05:17 -04:00
|
|
|
|
We then have the first-order sentence
|
|
|
|
|
\begin{equation*}
|
|
|
|
|
c \equiv
|
2021-05-26 10:38:36 -04:00
|
|
|
|
{} \Exists{j\in J}{\Exists{k\in K_j}\cpredmatseq\monoidop\cpredvecseq}
|
|
|
|
|
\monoidop\cpredscalarseq.
|
2021-05-14 12:05:17 -04:00
|
|
|
|
\end{equation*}
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\end{axiom}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\begin{axiom}[Classification Yield]\axmlabel{class-yield}
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\indexsym\Gamma{classification, yield}
|
|
|
|
|
\index{classification!yield (\ensuremath\gamma, \ensuremath\Gamma)}
|
2021-05-26 10:38:36 -04:00
|
|
|
|
Let $\Classify^c_\gamma\left(\Monoid\Bool\monoidop e,M,v,s\right)$ be a
|
2021-05-18 10:06:32 -04:00
|
|
|
|
classification by~\axmref{class-intro}.
|
|
|
|
|
Then,
|
2021-05-18 14:15:52 -04:00
|
|
|
|
|
2021-05-20 15:22:06 -04:00
|
|
|
|
\begin{subequations}
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\begin{align}
|
|
|
|
|
r &= \begin{cases}
|
|
|
|
|
2 &M\neq\emptyset, \\
|
|
|
|
|
1 &M=\emptyset \land v\neq\emptyset, \\
|
|
|
|
|
0 &M\union v = \emptyset,
|
|
|
|
|
\end{cases} \\
|
2021-05-24 12:57:09 -04:00
|
|
|
|
\displaybreak[0]
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\exists{j\in J}\Big(\exists{k\in K_j}\Big(
|
2021-05-26 10:38:36 -04:00
|
|
|
|
\Gamma^2_{j_k} &= \cpredmatseq\monoidop\cpredvecseq\monoidop\cpredscalarseq
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\Big)\Big), \\
|
|
|
|
|
%
|
|
|
|
|
\exists{j\in J}\Big(
|
2021-05-26 10:38:36 -04:00
|
|
|
|
\Gamma^1_j &= \cpredvecseq\monoidop\cpredscalarseq
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\Big), \\
|
|
|
|
|
%
|
|
|
|
|
\Gamma^0 &= \cpredscalarseq. \\
|
|
|
|
|
%
|
|
|
|
|
\gamma &= \Gamma^r.
|
|
|
|
|
\end{align}
|
2021-05-20 15:22:06 -04:00
|
|
|
|
\end{subequations}
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\end{axiom}
|
|
|
|
|
|
|
|
|
|
\begin{theorem}[Classification Composition]\thmlabel{class-compose}
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\index{classification!composition|(}
|
2021-05-18 10:06:32 -04:00
|
|
|
|
Classifications may be composed to create more complex classifications
|
|
|
|
|
using the classification yield~$\gamma$ as in~\axmref{class-yield}.
|
|
|
|
|
This interpretation is equivalent to \axmref{class-pred} by
|
|
|
|
|
\begin{equation}
|
|
|
|
|
c \equiv \Exists{j\in J}{
|
|
|
|
|
\Exists{k\in K_j}{\Gamma^2_{j_k}}
|
2021-05-26 10:38:36 -04:00
|
|
|
|
\monoidop \Gamma^1_j
|
2021-05-18 10:06:32 -04:00
|
|
|
|
}
|
2021-05-26 10:38:36 -04:00
|
|
|
|
\monoidop \Gamma^0.
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\end{equation}
|
|
|
|
|
\end{theorem}
|
|
|
|
|
|
|
|
|
|
\def\eejJ{\equiv \exists{j\in J}\Big(}
|
|
|
|
|
|
|
|
|
|
\begin{proof}
|
|
|
|
|
Expanding each~$\Gamma$ in \axmref{class-yield},
|
|
|
|
|
we have
|
|
|
|
|
|
|
|
|
|
\begin{alignat*}{3}
|
|
|
|
|
c &\eejJ\Exists{k\in K_j}{\Gamma^2_{j_k}}
|
2021-05-26 10:38:36 -04:00
|
|
|
|
\monoidop \Gamma^1_j
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\Big)
|
2021-05-26 10:38:36 -04:00
|
|
|
|
\monoidop \Gamma^0
|
2021-05-18 10:06:32 -04:00
|
|
|
|
&&\text{by \axmref{class-yield}} \\
|
|
|
|
|
%
|
|
|
|
|
&\eejJ\exists{k\in K_j}\Big(
|
2021-05-26 10:38:36 -04:00
|
|
|
|
\cpredmatseq \monoidop \cpredvecseq \monoidop \cpredscalarseq
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\Big) \\
|
2021-05-26 10:38:36 -04:00
|
|
|
|
&\hphantom{\eejJ}\;\cpredvecseq \monoidop \cpredscalarseq \Big)
|
|
|
|
|
\monoidop \cpredscalarseq, \\
|
2021-05-18 10:06:32 -04:00
|
|
|
|
%
|
|
|
|
|
&\eejJ\exists{k\in K_j}\Big(\cpredmatseq\Big)
|
2021-05-26 10:38:36 -04:00
|
|
|
|
\monoidop \cpredvecseq \monoidop \cpredscalarseq \\
|
|
|
|
|
&\hphantom{\eejJ}\;\cpredvecseq \monoidop \cpredscalarseq \Big)
|
|
|
|
|
\monoidop \cpredscalarseq,
|
2021-05-18 10:06:32 -04:00
|
|
|
|
&&\text{by \dfnref{quant-conn}} \\
|
|
|
|
|
%
|
|
|
|
|
&\eejJ\exists{k\in K_j}\Big(\cpredmatseq\Big)
|
|
|
|
|
&&\text{by \dfnref{prop-taut}} \\
|
2021-05-26 10:38:36 -04:00
|
|
|
|
&\hphantom{\eejJ}\;\cpredvecseq \monoidop \cpredscalarseq \Big)
|
|
|
|
|
\monoidop \cpredscalarseq, \\
|
2021-05-18 10:06:32 -04:00
|
|
|
|
%
|
|
|
|
|
&\eejJ\exists{k\in K_j}\Big(\cpredmatseq\Big)
|
|
|
|
|
&&\text{by \dfnref{quant-conn}} \\
|
2021-05-26 10:38:36 -04:00
|
|
|
|
&\hphantom{\eejJ}\;\cpredvecseq\Big) \monoidop \cpredscalarseq
|
|
|
|
|
\monoidop \cpredscalarseq, \\
|
2021-05-18 10:06:32 -04:00
|
|
|
|
%
|
|
|
|
|
&\eejJ\exists{k\in K_j}\Big(\cpredmatseq\Big)
|
|
|
|
|
&&\text{by \dfnref{prop-taut}} \\
|
|
|
|
|
&\hphantom{\eejJ}\;\cpredvecseq\Big)
|
2021-05-26 10:38:36 -04:00
|
|
|
|
\monoidop \cpredscalarseq.
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\tag*{\qedhere} \\
|
|
|
|
|
\end{alignat*}
|
|
|
|
|
\end{proof}
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\index{classification!composition|)}
|
2021-05-18 10:06:32 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\begin{lemma}[Classification Predicate Vacuity]\lemlabel{class-pred-vacu}
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\index{classification!vacuity|(}
|
2021-05-26 10:38:36 -04:00
|
|
|
|
Let $\Classify^c_\gamma\left(\Monoid\Bool\monoidop e,\emptyset,\emptyset,\emptyset\right)$
|
2021-05-18 10:06:32 -04:00
|
|
|
|
be a classification by~\axmref{class-intro}.
|
|
|
|
|
$\odot$ is a monoid by \corref{odot-monoid}.
|
|
|
|
|
Then $c \equiv \gamma \equiv e$.
|
|
|
|
|
\end{lemma}
|
|
|
|
|
\begin{proof}
|
|
|
|
|
First consider $c$.
|
2021-05-20 15:22:06 -04:00
|
|
|
|
\begin{alignat*}{3}
|
2021-05-26 10:38:36 -04:00
|
|
|
|
c &\equiv \Exists{j\in J}{\Exists{k}{e}\monoidop e} \monoidop e
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\qquad&&\text{by \dfnref{monoid-seq}} \label{p:cri-c} \\
|
2021-05-26 10:38:36 -04:00
|
|
|
|
&\equiv \Exists{j\in J}{e \monoidop e} \monoidop e
|
2021-05-18 10:06:32 -04:00
|
|
|
|
&&\text{by \dfnref{quant-elim}} \\
|
2021-05-26 10:38:36 -04:00
|
|
|
|
&\equiv \Exists{j\in J}{e} \monoidop e
|
2021-05-18 10:06:32 -04:00
|
|
|
|
&&\text{by \ref{eq:monoid-identity}} \\
|
2021-05-26 10:38:36 -04:00
|
|
|
|
&\equiv e \monoidop e
|
2021-05-18 10:06:32 -04:00
|
|
|
|
&&\text{by \dfnref{quant-elim}} \\
|
|
|
|
|
&\equiv e.
|
|
|
|
|
&&\text{by \ref{eq:monoid-identity}}
|
2021-05-20 15:22:06 -04:00
|
|
|
|
\end{alignat*}
|
2021-05-18 10:06:32 -04:00
|
|
|
|
|
|
|
|
|
For $\gamma$,
|
|
|
|
|
we have $r=0$ by \axmref{class-yield},
|
|
|
|
|
and so by similar steps as~$c$,
|
|
|
|
|
$\gamma=\Gamma^r=e$.
|
|
|
|
|
Therefore $c\equiv e$.
|
|
|
|
|
\end{proof}
|
|
|
|
|
|
|
|
|
|
|
2021-05-24 12:36:57 -04:00
|
|
|
|
\begin{figure}[ht]
|
2021-05-18 14:09:27 -04:00
|
|
|
|
\begin{alignat*}{3}
|
|
|
|
|
\begin{aligned}
|
|
|
|
|
\xml{<classify }&\xml{as="always" yields="alwaysTrue"} \xmlnl
|
|
|
|
|
&\xml{desc="Always true" />}
|
|
|
|
|
\end{aligned}
|
|
|
|
|
\quad&=\quad
|
2021-05-25 10:50:55 -04:00
|
|
|
|
\Classifyland^\texttt{always}_\texttt{alwaysTrue}
|
|
|
|
|
&&\left(\emptyset,\emptyset,\emptyset\right). \\
|
2021-05-18 14:09:27 -04:00
|
|
|
|
%
|
|
|
|
|
\begin{aligned}
|
|
|
|
|
\xml{<classify }&\xml{as="never" yields="neverTrue"} \xmlnl
|
|
|
|
|
&\xml{any="true"} \xmlnl
|
|
|
|
|
&\xml{desc="Never true" />}
|
|
|
|
|
\end{aligned}
|
|
|
|
|
\quad&=\quad
|
2021-05-25 10:50:55 -04:00
|
|
|
|
\Classifylor^\texttt{never}_\texttt{neverTrue}
|
|
|
|
|
&&\left(\emptyset,\emptyset,\emptyset\right).
|
2021-05-18 14:09:27 -04:00
|
|
|
|
\end{alignat*}
|
|
|
|
|
\caption{\tameclass{always} and \tameclass{never} from package
|
|
|
|
|
\tamepkg{core/base}.}
|
2021-05-24 12:36:57 -04:00
|
|
|
|
\label{fig:always-never}
|
2021-05-18 14:09:27 -04:00
|
|
|
|
\end{figure}
|
|
|
|
|
|
2021-05-24 12:36:57 -04:00
|
|
|
|
\spref{fig:always-never} demonstrates \lemref{class-pred-vacu} in the
|
2021-05-18 15:06:35 -04:00
|
|
|
|
definitions of the classifications \tameclass{always} and
|
|
|
|
|
\tameclass{never}.
|
2021-05-18 14:09:27 -04:00
|
|
|
|
These classifications are typically referenced directly for clarity rather
|
|
|
|
|
than creating other vacuous classifications,
|
|
|
|
|
encapsulating \lemref{class-pred-vacu}.
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\index{classification!vacuity|)}
|
2021-05-18 14:09:27 -04:00
|
|
|
|
|
|
|
|
|
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\begin{theorem}[Classification Rank Independence]\thmlabel{class-rank-indep}
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\index{classification!rank|(}
|
2021-05-26 10:38:36 -04:00
|
|
|
|
Let $\odot=\Monoid\Bool\monoidop e$.
|
2021-05-18 10:06:32 -04:00
|
|
|
|
Then,
|
|
|
|
|
\begin{equation}
|
|
|
|
|
\Classify_\gamma\left(\odot,M,v,s\right)
|
|
|
|
|
\equiv \Classify\left(
|
|
|
|
|
\odot,
|
|
|
|
|
\Classify_{\gamma'''}\left(\odot,M,\emptyset,\emptyset\right),
|
|
|
|
|
\Classify_{\gamma''}\left(\odot,\emptyset,v,\emptyset\right),
|
|
|
|
|
\Classify_{\gamma'}\left(\odot,\emptyset,\emptyset,s\right)
|
|
|
|
|
\right).
|
|
|
|
|
\end{equation}
|
|
|
|
|
\end{theorem}
|
|
|
|
|
|
|
|
|
|
\begin{proof}
|
|
|
|
|
First,
|
|
|
|
|
by \axmref{class-yield},
|
|
|
|
|
observe these special cases following from \lemref{class-pred-vacu}:
|
2021-05-20 15:22:06 -04:00
|
|
|
|
\begin{equation}
|
|
|
|
|
\begin{alignedat}{3}
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\Gamma'''^2 &= \cpredmatseq, \qquad&&\text{assuming $v\union s=\emptyset$} \\
|
2021-05-20 15:22:06 -04:00
|
|
|
|
\Gamma''^1 &= \cpredvecseq, &&\text{assuming $M\union s=\emptyset$} \\
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\Gamma'^0 &= \cpredscalarseq. &&\text{assuming $M\union v=\emptyset$}
|
2021-05-20 15:22:06 -04:00
|
|
|
|
\end{alignedat}
|
|
|
|
|
\end{equation}
|
2021-05-18 10:06:32 -04:00
|
|
|
|
|
|
|
|
|
By \thmref{class-compose},
|
|
|
|
|
we must prove
|
2021-05-20 15:22:06 -04:00
|
|
|
|
\begin{multline}\label{eq:rank-indep-goal}
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\Exists{j\in J}{
|
|
|
|
|
\Exists{k\in K_j}{\cpredmatseq}
|
2021-05-26 10:38:36 -04:00
|
|
|
|
\monoidop \cpredvecseq
|
2021-05-18 10:06:32 -04:00
|
|
|
|
}
|
2021-05-26 10:38:36 -04:00
|
|
|
|
\monoidop \cpredscalarseq \\
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\equiv c \equiv
|
|
|
|
|
\Exists{j\in J}{
|
|
|
|
|
\Exists{k\in K_j}{\gamma'''_{j_k}}
|
2021-05-26 10:38:36 -04:00
|
|
|
|
\monoidop \gamma''_j
|
2021-05-18 10:06:32 -04:00
|
|
|
|
}
|
2021-05-26 10:38:36 -04:00
|
|
|
|
\monoidop \gamma'.
|
2021-05-20 15:22:06 -04:00
|
|
|
|
\end{multline}
|
2021-05-18 10:06:32 -04:00
|
|
|
|
|
|
|
|
|
By \axmref{class-yield},
|
|
|
|
|
we have $r'''=2$, $r''=1$, and $r'=0$,
|
|
|
|
|
and so $\gamma'''=\Gamma'''^2$,
|
|
|
|
|
$\gamma''=\Gamma''^1$,
|
|
|
|
|
and $\gamma'=\Gamma'^0$.
|
|
|
|
|
By substituting these values in~\ref{eq:rank-indep-goal},
|
|
|
|
|
the theorem is proved.
|
|
|
|
|
\end{proof}
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\index{classification!rank|)}
|
2021-05-11 16:37:08 -04:00
|
|
|
|
|
2021-05-20 10:45:44 -04:00
|
|
|
|
These definitions may also be used as a form of pattern matching to look up
|
|
|
|
|
a corresponding variable.
|
|
|
|
|
For example,
|
|
|
|
|
if we have $\Classify^\texttt{foo}$ and want to know its \xmlattr{yields},
|
|
|
|
|
we can write~$\Classify^\texttt{foo}_\gamma$ to bind the
|
|
|
|
|
\xmlattr{yields} to~$\gamma$.\footnote{%
|
|
|
|
|
This is conceptually like a symbol table lookup in the compiler.}
|
|
|
|
|
|
|
|
|
|
|
2021-05-26 11:32:31 -04:00
|
|
|
|
|
2021-05-20 10:45:44 -04:00
|
|
|
|
\subsection{Matches}
|
2021-05-26 11:32:31 -04:00
|
|
|
|
A classification consists of a set of binary predicates called
|
|
|
|
|
\emph{matches}.
|
|
|
|
|
Matches may reference any values,
|
|
|
|
|
including the results of other classifications
|
|
|
|
|
(as in \thmpref{class-compose}),
|
|
|
|
|
allowing for the construction of complex abstractions over the data being
|
|
|
|
|
classified.
|
|
|
|
|
|
|
|
|
|
Matches are intended to act intuitively across inputs of different ranks---%
|
|
|
|
|
that is,
|
|
|
|
|
one can match on any combination of matrix, vector, and scalar values.
|
|
|
|
|
|
2021-05-20 10:45:44 -04:00
|
|
|
|
\begin{axiom}[Match Input Translation]\axmlabel{match-input}
|
|
|
|
|
Let $j$ and $k$ be free variables intended to be bound in the
|
|
|
|
|
context of \axmref{class-pred}.
|
|
|
|
|
Let $J$ and $K$ be defined by \axmref{class-intro}.
|
|
|
|
|
Given some input~$x$,
|
|
|
|
|
|
|
|
|
|
\begin{equation*}
|
|
|
|
|
\varsub x =
|
|
|
|
|
\begin{cases}
|
2021-05-20 15:28:10 -04:00
|
|
|
|
x_{j_k} &\rank{x} = 2; \\
|
|
|
|
|
x_j &\rank{x} = 1; \\
|
|
|
|
|
x &\rank{x} = 0,
|
2021-05-20 10:45:44 -04:00
|
|
|
|
\end{cases}
|
|
|
|
|
\qquad\qquad
|
|
|
|
|
\begin{aligned}
|
|
|
|
|
j&\in J, \\
|
|
|
|
|
k&\in K_j.
|
|
|
|
|
\end{aligned}
|
|
|
|
|
\end{equation*}
|
|
|
|
|
\end{axiom}
|
|
|
|
|
|
|
|
|
|
\begin{axiom}[Match Rank]\axmlabel{match-rank}
|
|
|
|
|
Let~$\sim{} : \Real\times\Real\rightarrow\Real$ be some binary relation.
|
|
|
|
|
Then,
|
|
|
|
|
|
|
|
|
|
\begin{equation*}
|
2021-05-20 15:28:10 -04:00
|
|
|
|
\rank{\varsub x \sim \varsub y} =
|
2021-05-20 10:45:44 -04:00
|
|
|
|
\begin{cases}
|
2021-05-20 15:28:10 -04:00
|
|
|
|
\rank{x} &\rank{x} \geq \rank{y}, \\
|
|
|
|
|
\rank{y} &\text{otherwise}.
|
2021-05-20 10:45:44 -04:00
|
|
|
|
\end{cases}
|
|
|
|
|
\end{equation*}
|
|
|
|
|
\end{axiom}
|
|
|
|
|
|
|
|
|
|
\def\xyequivish{\varsub x\equivish \varsub y}
|
|
|
|
|
|
|
|
|
|
\begin{axiom}[Element-Wise Equivalence ($\equivish$)]
|
|
|
|
|
\indexsym\equivish{equivalence, element-wise}
|
|
|
|
|
\index{equivalence!element-wise (\ensuremath\equivish)}
|
|
|
|
|
\begin{align*}
|
2021-05-20 15:28:10 -04:00
|
|
|
|
\rank{\varsub x}=\rank{\varsub y}=2,\,
|
2021-05-20 10:45:44 -04:00
|
|
|
|
(\xyequivish) &\infer \Forall{j,k}{x_{j_k} \equiv y_{j_k}}, \\
|
2021-05-20 15:28:10 -04:00
|
|
|
|
\rank{\varsub x}=\rank{\varsub y}=1,\,
|
2021-05-20 10:45:44 -04:00
|
|
|
|
(\xyequivish) &\infer \Forall{j}{x_j \equiv y_j}, \\
|
2021-05-20 15:28:10 -04:00
|
|
|
|
\rank{\varsub x}=\rank{\varsub y}=0,\,
|
2021-05-20 10:45:44 -04:00
|
|
|
|
(\xyequivish) &\infer (x\equiv y).
|
|
|
|
|
\end{align*}
|
|
|
|
|
\end{axiom}
|
|
|
|
|
|
2021-05-26 11:32:31 -04:00
|
|
|
|
|
|
|
|
|
\index{package!core/match@\tamepkg{core/match}}
|
|
|
|
|
Matches are represented by \xmlnode{match} nodes in \tame{}.
|
|
|
|
|
Since the primitive is rather verbose,
|
|
|
|
|
\tamepkg{core/match} also defines templates providing a more concise
|
|
|
|
|
notation
|
|
|
|
|
(\xmlnode{t:match-$\zeta$} below).
|
|
|
|
|
|
2021-05-20 10:45:44 -04:00
|
|
|
|
\index{classification!match@\xmlnode{match}}
|
|
|
|
|
\begin{axiom}[Match Introduction]\axmlabel{match-intro}
|
|
|
|
|
\begin{alignat*}{2}
|
|
|
|
|
\begin{aligned}[b]
|
|
|
|
|
\xml{<t:match-$\zeta$ }&\xml{on="$x$"} \xmlnll
|
|
|
|
|
&\xml{value="$y$" />}
|
|
|
|
|
\end{aligned}
|
|
|
|
|
{}&\equivish{}
|
|
|
|
|
\begin{aligned}
|
|
|
|
|
&\xml{<match on="$x$">} \xmlnll
|
|
|
|
|
&\quad \xml{<c:$\zeta$>} \xmlnll
|
|
|
|
|
&\quad\quad \xml{<c:value-of name="$y$">} \xmlnll
|
|
|
|
|
&\quad \xml{</c:$\zeta$>} \xmlnll
|
|
|
|
|
&\xml{</match>}
|
|
|
|
|
\end{aligned}
|
|
|
|
|
\qquad
|
|
|
|
|
\sim{} = \smash{\begin{cases}
|
|
|
|
|
= &\zeta=\xml{eq}, \\
|
|
|
|
|
< &\zeta=\xml{lt}, \\
|
|
|
|
|
> &\zeta=\xml{gt}, \\
|
|
|
|
|
\leq &\zeta=\xml{leq}, \\
|
|
|
|
|
\geq &\zeta=\xml{geq}.
|
|
|
|
|
\end{cases}} \\
|
|
|
|
|
&\equivish \varsub x \sim \varsub y,
|
|
|
|
|
\end{alignat*}
|
|
|
|
|
\end{axiom}
|
|
|
|
|
|
|
|
|
|
\begin{axiom}[Match Equality Short Form]
|
|
|
|
|
\begin{equation*}
|
|
|
|
|
\xml{<match on="$x$" />}
|
|
|
|
|
\equivish \xml{<match on="$x$" value="TRUE" />}.
|
|
|
|
|
\end{equation*}
|
|
|
|
|
\end{axiom}
|
|
|
|
|
|
|
|
|
|
\todo{Define types and \xml{typedef}.}
|
|
|
|
|
\begin{axiom}[Match Membership]
|
|
|
|
|
When $T$ is a type defined with \xmlnode{typedef},
|
|
|
|
|
\begin{equation*}
|
|
|
|
|
\xml{<match on="$x$" anyOf="$T$" />} \equivish \varsub x \in T.
|
|
|
|
|
\end{equation*}
|
|
|
|
|
\end{axiom}
|
|
|
|
|
|
|
|
|
|
\begin{theorem}[Classification Match Element-Wise Binary Relation]
|
|
|
|
|
\thmlabel{class-match}
|
|
|
|
|
Within the context of \axmref{class-pred},
|
|
|
|
|
all \xmlnode{match} forms represent binary relations
|
|
|
|
|
$\Real\times\Real\rightarrow\Bool$
|
|
|
|
|
ranging over individual elements of all index sets $J$ and $K_j\in K$.
|
|
|
|
|
\end{theorem}
|
|
|
|
|
\begin{proof}
|
|
|
|
|
First,
|
|
|
|
|
observe that each of $=$, $<$, $>$, $\leq$, $\geq$, and $\in$
|
|
|
|
|
have type $\Real\times\Real\rightarrow\Bool$.
|
|
|
|
|
We must then prove that $\varsub x$ and $\varsub y$ are able to be
|
|
|
|
|
interpreted as~$\Real$ within the context of \axmref{class-pred}.
|
|
|
|
|
|
|
|
|
|
When $x,y\in\Real$,
|
|
|
|
|
we have the trivial case $\varsub x=x\in\Real$ and $\varsub y=y\in\Real$
|
|
|
|
|
by \axmref{match-input}.
|
|
|
|
|
Otherwise,
|
|
|
|
|
variables $j$ and $k$ are free.
|
|
|
|
|
|
2021-05-20 15:28:10 -04:00
|
|
|
|
Consider $\rank{\varsub x \sim \varsub y} = 2$;
|
|
|
|
|
then $\rank{\varsub x \sim \varsub y} \in\Matrices$ by \dfnref{rank},
|
2021-05-20 10:45:44 -04:00
|
|
|
|
and so by \thmref{class-rank-indep} we have
|
|
|
|
|
\begin{equation}\label{p:match-rel}
|
|
|
|
|
\Forall{j\in J}{\Forall{k\in K_j}{\cpredmatseq}}
|
|
|
|
|
\equiv
|
|
|
|
|
\Forall{j\in J}{\Forall{k\in K_j}{\varsub x \sim \varsub y}},
|
|
|
|
|
\end{equation}
|
|
|
|
|
which binds $j$ and $k$ to the variables of their respective quantifiers.
|
2021-05-20 15:28:10 -04:00
|
|
|
|
Proceed similarly for $\rank{\varsub x \sim \varsub y} = 1$ and observe that
|
2021-05-20 10:45:44 -04:00
|
|
|
|
$j$ becomes bound.
|
|
|
|
|
|
|
|
|
|
Assume $x\in\Matrices$;
|
|
|
|
|
then $x_{j_k}\in\Real$ by \dfnref{matrix}.
|
|
|
|
|
Assume $y\in\Vectors^\Real$;
|
|
|
|
|
then $y_j\in\Real$ by \dfnref{vec}.
|
|
|
|
|
Finally,
|
|
|
|
|
observe that $j$ ranges over $J$ in \ref{p:match-rel},
|
|
|
|
|
and $k$ over $K_j$.
|
|
|
|
|
\end{proof}
|
|
|
|
|
|
|
|
|
|
\thmref{class-match} is responsible for proving that matches range over each
|
|
|
|
|
individual index.
|
|
|
|
|
More subtly,
|
|
|
|
|
it also shows that matches work with any combination of rank.
|
2021-05-24 12:32:00 -04:00
|
|
|
|
\spref{f:ex:class-match-all-ranks} demonstrates a complete translation of
|
|
|
|
|
source \tame{}~XML using all ranks.
|
|
|
|
|
|
|
|
|
|
\begin{figure}[ht]
|
|
|
|
|
\begin{align}
|
|
|
|
|
&\begin{aligned}
|
|
|
|
|
&\xml{<classify as="fullrank" desc="Example of all ranks">} \xmlnl
|
|
|
|
|
&\quad\begin{aligned}
|
|
|
|
|
&\xml{<match on="$A$" value="$u$" />}
|
2021-05-24 13:14:16 -04:00
|
|
|
|
\quad&&\equivish \varsub A = \varsub u \\[-2mm]
|
2021-05-24 12:32:00 -04:00
|
|
|
|
&\xml{<match on="$A$" value="$t$" />}
|
|
|
|
|
\quad&&\equivish \varsub A = \varsub t \xmlnll
|
|
|
|
|
&\xml{<match on="$u$" value="$t$" />}
|
|
|
|
|
\quad&&\equivish \varsub u = \varsub t \xmlnll
|
|
|
|
|
&\xml{<match on="$t$" />}
|
|
|
|
|
\quad&&\equivish \varsub t = \true
|
|
|
|
|
\end{aligned} \xmlnll
|
|
|
|
|
&\xml{</classify>}
|
|
|
|
|
\end{aligned}
|
|
|
|
|
&\text{by \axmref{match-intro}} \\
|
2021-05-25 10:50:55 -04:00
|
|
|
|
&= \Classifyland^\texttt{fullrank}\left(
|
2021-05-24 12:32:00 -04:00
|
|
|
|
\Big(\left({A_j}_k = u_j\right),
|
|
|
|
|
\left({A_j}_k = t \right)
|
|
|
|
|
\Big),
|
|
|
|
|
\left(u_j = t\right),
|
|
|
|
|
t
|
|
|
|
|
\right)
|
|
|
|
|
&\text{by \axmref{class-intro}} \\
|
|
|
|
|
&\equiv \Exists{j\in J}{
|
|
|
|
|
\Exists*{k\in K_j}{\Big(
|
|
|
|
|
\left({A_j}_k = u_j\right)
|
|
|
|
|
\land \left({A_j}_k = t \right)
|
|
|
|
|
\Big)}
|
|
|
|
|
\land u_j = t
|
|
|
|
|
}
|
|
|
|
|
\land t.
|
|
|
|
|
&\text{by \thmref{class-match}}.
|
|
|
|
|
\end{align}
|
|
|
|
|
\caption{Example demonstrating \thmref{class-match} using all ranks.}
|
|
|
|
|
\label{f:ex:class-match-all-ranks}
|
|
|
|
|
\end{figure}
|
2021-05-20 10:45:44 -04:00
|
|
|
|
|
2021-05-26 10:33:01 -04:00
|
|
|
|
Visually,
|
|
|
|
|
the one-dimensional construction of \axmref{class-pred} does not lend
|
|
|
|
|
itself well to how intuitive the behavior of the system actually is.
|
|
|
|
|
We therefore establish a relationship to the notation of linear algebra
|
|
|
|
|
to emphasize the relationship between each of the inputs.
|
|
|
|
|
|
|
|
|
|
\newcommand\matseqsup[1]{%
|
|
|
|
|
\begin{bmatrix}
|
|
|
|
|
M^{#1}_{0_0} & \dots & M^{#1}_{0_k} \\
|
|
|
|
|
\vdots & \ddots & \vdots \\
|
|
|
|
|
M^{#1}_{j_0} & \dots & M^{#1}_{j_k} \\
|
|
|
|
|
\end{bmatrix}%
|
|
|
|
|
}
|
|
|
|
|
\newcommand\vecseqsup[1]{%
|
|
|
|
|
\begin{bmatrix}
|
|
|
|
|
v^{#1}_0 \\
|
|
|
|
|
\vdots \\
|
|
|
|
|
v^{#1}_j \\
|
|
|
|
|
\end{bmatrix}%
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
% This must be an axiom because it defines how the connectives operate; see
|
|
|
|
|
% the remark.
|
2021-05-26 11:32:31 -04:00
|
|
|
|
\index{classification!matrix notation}
|
2021-05-26 10:33:01 -04:00
|
|
|
|
\begin{axiom}[Classification Matrix Notation]\axmlabel{class-mat-not}
|
|
|
|
|
Let $\Gamma^2$ be defined by \axmref{class-yield}.
|
|
|
|
|
Then,
|
|
|
|
|
\begin{equation*}
|
|
|
|
|
\Gamma^2 =
|
|
|
|
|
\matseqsup{0}\monoidops\matseqsup{l}
|
|
|
|
|
\monoidop
|
|
|
|
|
\vecseqsup{0}\monoidops\vecseqsup{m}
|
|
|
|
|
\monoidop
|
|
|
|
|
s^0\monoidops s^n,
|
|
|
|
|
\end{equation*}
|
|
|
|
|
from which $\Gamma^1$, $\Gamma^0$, and $\gamma$ can be derived.
|
|
|
|
|
\end{axiom}
|
|
|
|
|
|
|
|
|
|
\begin{remark}[Logical Connectives With Matrix Notation]
|
|
|
|
|
From the definition of \axmref{class-mat-not},
|
|
|
|
|
it should be clear that the logical connective $\monoidop$ necessarily
|
2021-05-26 13:04:55 -04:00
|
|
|
|
acts like a Hadamard product\cite{wp:hadamard-product} with respect to
|
|
|
|
|
how individual elements are combined.
|
2021-05-26 10:33:01 -04:00
|
|
|
|
\end{remark}
|
|
|
|
|
|
2021-05-26 11:32:31 -04:00
|
|
|
|
\index{classification!intuition}
|
2021-05-26 10:33:01 -04:00
|
|
|
|
\axmref{class-mat-not} makes it easy to visualize classification
|
|
|
|
|
operations simply by drawing horizontal boxes across the predicates,
|
|
|
|
|
as demonstrated by \spref{f:class-mat-boxes}.
|
2021-05-26 11:32:31 -04:00
|
|
|
|
This visualization helps to show intuitively how the classification system
|
|
|
|
|
is intended to function,
|
|
|
|
|
with matrices serving as higher-resolution vectors.\footnote{%
|
|
|
|
|
For example,
|
|
|
|
|
with insurance,
|
|
|
|
|
one may have a vector of data by risk location,
|
|
|
|
|
and a matrix of chosen class codes by location.
|
|
|
|
|
Consequently,
|
|
|
|
|
we expect $M_j$ to be the set of class codes associated with
|
|
|
|
|
location~$j$ so that it can be easily matched against location-level
|
|
|
|
|
data~$v_j$.}
|
2021-05-26 10:33:01 -04:00
|
|
|
|
|
|
|
|
|
% NB: Give this formatting extra attention if the document's formatting is
|
|
|
|
|
% substantially changed, since it's not exactly responsible with it's
|
|
|
|
|
% hard-coded units.
|
|
|
|
|
\begingroup
|
|
|
|
|
\begin{figure}[ht]
|
|
|
|
|
\def\classmatraise#1{%
|
|
|
|
|
\begin{aligned}
|
|
|
|
|
#1 \\ {} \\ #1
|
|
|
|
|
\end{aligned}
|
|
|
|
|
}
|
|
|
|
|
\def\classmateq{%
|
|
|
|
|
\matseqsup{0}
|
|
|
|
|
\classmatraise{\monoidop\cdots\monoidop}
|
|
|
|
|
\matseqsup{l}
|
|
|
|
|
\classmatraise\monoidop
|
|
|
|
|
\vecseqsup{0}
|
|
|
|
|
\classmatraise{\monoidop\cdots\monoidop}
|
|
|
|
|
\vecseqsup{m}
|
|
|
|
|
\classmatraise{%
|
|
|
|
|
{}\monoidop s^0\monoidop\cdots\monoidop s^n%
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-05-27 10:58:54 -04:00
|
|
|
|
\def\classmatlines#1{%
|
|
|
|
|
\begin{alignedat}{2}
|
|
|
|
|
\Big( &M^0_{{#1}_0} \monoidops {}&&M^l_{{#1}_0} \Big)
|
|
|
|
|
\monoidop
|
|
|
|
|
v^0_{#1} \monoidops v^m_{#1}
|
|
|
|
|
\monoidop
|
|
|
|
|
s^0 \monoidops s^n \\
|
|
|
|
|
&\quad\!\vdots &&\quad\!\vdots \\
|
|
|
|
|
\Big( &M^0_{{#1}_k} \monoidops {}&&M^l_{{#1}_k} \Big)
|
|
|
|
|
\monoidop
|
|
|
|
|
v^0_{#1} \monoidops v^m_{#1}
|
|
|
|
|
\monoidop
|
|
|
|
|
s^0 \monoidops s^n
|
|
|
|
|
\end{alignedat}
|
|
|
|
|
}
|
2021-05-26 10:33:01 -04:00
|
|
|
|
|
|
|
|
|
\begin{align*}
|
2021-05-27 10:58:54 -04:00
|
|
|
|
&\quad\raisebox{-11mm}[0mm]{%
|
2021-05-26 10:33:01 -04:00
|
|
|
|
\begin{turn}{45}
|
|
|
|
|
$\equiv$
|
|
|
|
|
\end{turn}%
|
2021-05-27 10:58:54 -04:00
|
|
|
|
}\; \classmatlines{0} &\Gamma^2_0 \\[-2mm]
|
2021-05-26 10:33:01 -04:00
|
|
|
|
&\fbox{\raisebox{0mm}[0mm][6mm]{\hphantom{$\classmateq$}}} \\[-8mm]
|
|
|
|
|
%
|
|
|
|
|
&\classmateq &\vdots\; \\[-10mm]
|
|
|
|
|
%
|
|
|
|
|
&\fbox{\raisebox{0mm}[0mm][6mm]{\hphantom{$\classmateq$}}} \\
|
2021-05-27 10:58:54 -04:00
|
|
|
|
&\quad\raisebox{11mm}[0mm]{%
|
2021-05-26 10:33:01 -04:00
|
|
|
|
\begin{turn}{-45}
|
|
|
|
|
$\equiv$
|
|
|
|
|
\end{turn}%
|
2021-05-27 10:58:54 -04:00
|
|
|
|
}\; \classmatlines{j} &\Gamma^2_j
|
2021-05-26 10:33:01 -04:00
|
|
|
|
\end{align*}
|
|
|
|
|
\caption{Visual interpretation of classification by \axmref{class-mat-not}.
|
2021-05-26 14:33:31 -04:00
|
|
|
|
For each boxed row of the matrix notation there is an equivalence
|
2021-05-27 10:58:54 -04:00
|
|
|
|
to the first-order logic of \thmref{class-compose}.}
|
2021-05-26 10:33:01 -04:00
|
|
|
|
\label{f:class-mat-boxes}
|
|
|
|
|
\end{figure}
|
|
|
|
|
\endgroup
|
|
|
|
|
|
2021-05-19 10:48:35 -04:00
|
|
|
|
\index{classification!as proposition|(}
|
2021-05-20 10:45:44 -04:00
|
|
|
|
\begin{lemma}[Match As Proposition]\lemlabel{match-prop}
|
|
|
|
|
Matches can be represented using propositional logic provided that
|
|
|
|
|
binary operators of \axmref{match-intro} are restricted to $\cbif\Bool$.
|
|
|
|
|
\end{lemma}
|
2021-05-14 12:05:17 -04:00
|
|
|
|
\begin{proof}
|
2021-05-20 10:45:44 -04:00
|
|
|
|
\begin{alignat*}{4}
|
|
|
|
|
x = \true &\equiv x, &&\quad= &&: \cbif\Bool; \\
|
|
|
|
|
x = \false &\equiv \neg x, &&\quad= &&: \cbif\Bool; \\
|
|
|
|
|
x < y &\equiv \neg x \land y, &&\quad< &&: \cbif\Bool; \\
|
|
|
|
|
x > y &\equiv x \land \neg y, &&\quad> &&: \cbif\Bool; \\
|
|
|
|
|
x \leq y &\equiv \neg x \lor y, &&\quad\leq &&: \cbif\Bool; \\
|
|
|
|
|
x \geq y &\equiv x \lor \neg y, &&\quad\geq &&: \cbif\Bool; \\
|
|
|
|
|
x \in\Bool &\equiv \true, &&\quad\in &&: \cbif\Bool.\tag*{\qedhere}
|
|
|
|
|
\end{alignat*}
|
|
|
|
|
\end{proof}
|
|
|
|
|
|
|
|
|
|
\begin{theorem}[Classification As Proposition]
|
|
|
|
|
\index{classification!as proposition|(}
|
|
|
|
|
Classifications with either $M\union v=\emptyset$ or with constant index
|
|
|
|
|
sets can be represented by propositional logic provided that the domains
|
|
|
|
|
of the binary operators of \axmref{match-intro} are restricted to
|
|
|
|
|
$\cbif\Bool$.
|
|
|
|
|
\end{theorem}
|
|
|
|
|
\begin{proof}
|
|
|
|
|
Propositional logic does not include quantifiers or relations.
|
|
|
|
|
Matches of the domain $\cbif\Bool$ are proved to be propositions by
|
|
|
|
|
\lemref{match-prop}.
|
|
|
|
|
Having eliminated relations,
|
|
|
|
|
we must now eliminate quantifiers.
|
|
|
|
|
|
2021-05-18 10:06:32 -04:00
|
|
|
|
Assume $M\union v=\emptyset$.
|
|
|
|
|
By \thmref{class-rank-indep},
|
2021-05-14 12:05:17 -04:00
|
|
|
|
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\begin{align*}
|
|
|
|
|
c &\equiv \cpredscalarseq,
|
|
|
|
|
\end{align*}
|
2021-05-14 12:05:17 -04:00
|
|
|
|
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\noindent
|
|
|
|
|
which is a propositional formula.
|
2021-05-14 12:05:17 -04:00
|
|
|
|
|
|
|
|
|
Similarly,
|
2021-05-20 10:45:44 -04:00
|
|
|
|
if we define our index set~$J$ to be constant,
|
|
|
|
|
we are then able to eliminate existential quantification over~$J$
|
|
|
|
|
as follows:
|
2021-05-20 15:22:06 -04:00
|
|
|
|
\begin{equation}\label{eq:prop-vec}
|
|
|
|
|
\begin{aligned}
|
|
|
|
|
c &\equiv \Exists{j\in J}{\cpredvecseq}, \\
|
2021-05-26 10:38:36 -04:00
|
|
|
|
&\equiv \left(v^0_0\monoidops v^m_0\right)
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\lor\cdots\lor
|
2021-05-26 10:38:36 -04:00
|
|
|
|
\left(v^0_{|J|-1}\monoidops v^m_{|J|-1}\right),
|
2021-05-20 15:22:06 -04:00
|
|
|
|
\end{aligned}
|
|
|
|
|
\end{equation}
|
2021-05-14 12:05:17 -04:00
|
|
|
|
which is a propositional formula.
|
2021-05-18 10:06:32 -04:00
|
|
|
|
Similarly,
|
|
|
|
|
for matrices,
|
|
|
|
|
|
2021-05-20 15:22:06 -04:00
|
|
|
|
\begin{align*}
|
2021-05-18 10:06:32 -04:00
|
|
|
|
c &\equiv \Exists{j\in J}{\Exists{k\in K_j}{\cpredmatseq}}, \nonumber\\
|
|
|
|
|
&\equiv \Exists{j\in J}{
|
2021-05-26 10:38:36 -04:00
|
|
|
|
\left({M^0_j}_0\monoidops{M^0_j}_{|K_j|-1}\right)
|
2021-05-18 10:06:32 -04:00
|
|
|
|
\lor\cdots\lor
|
2021-05-26 10:38:36 -04:00
|
|
|
|
\left({M^l_j}_0\monoidops{M^l_j}_{|K_j|-1}\right)
|
2021-05-18 10:06:32 -04:00
|
|
|
|
},
|
2021-05-20 15:22:06 -04:00
|
|
|
|
\end{align*}
|
2021-05-18 10:06:32 -04:00
|
|
|
|
and then proceed as in~\ref{eq:prop-vec}.
|
2021-05-14 12:05:17 -04:00
|
|
|
|
\end{proof}
|
2021-05-20 10:45:44 -04:00
|
|
|
|
\index{classification!as proposition|)}
|