dissertation_work/MLP Ideas/commands.tex

700 lines
19 KiB
TeX
Raw Normal View History

2024-02-16 00:55:42 +00:00
\DeclareFontEncoding{LS1}{}{}
\DeclareFontSubstitution{LS1}{stix}{m}{n}
\DeclareMathAlphabet{\mathscr}{LS1}{stixscr}{m}{n}
\newcommand{\cA}{\mathcal{A}}
\newcommand{\cB}{\mathcal{B}}
\newcommand{\cC}{\mathcal{C}}
\newcommand{\cD}{\mathcal{D}}
\newcommand{\cE}{\mathcal{E}}
\newcommand{\cF}{\mathcal{F}}
\newcommand{\cG}{\mathcal{G}}
\newcommand{\cH}{\mathcal{H}}
\newcommand{\cI}{\mathcal{I}}
\newcommand{\cJ}{\mathcal{J}}
\newcommand{\cK}{\mathcal{K}}
\newcommand{\cL}{\mathcal{L}}
\newcommand{\cM}{\mathcal{M}}
\newcommand{\cN}{\mathcal{N}}
\newcommand{\cO}{\mathcal{O}}
\newcommand{\cP}{\mathcal{P}}
\newcommand{\cQ}{\mathcal{Q}}
\newcommand{\cR}{\mathcal{R}}
\newcommand{\cS}{\mathcal{S}}
\newcommand{\cT}{\mathcal{T}}
\newcommand{\cU}{\mathcal{U}}
\newcommand{\cV}{\mathcal{V}}
\newcommand{\cW}{\mathcal{W}}
\newcommand{\cX}{\mathcal{X}}
\newcommand{\cY}{\mathcal{Y}}
\newcommand{\cZ}{\mathcal{Z}}
\newcommand{\fA}{\mathfrak{A}}
\newcommand{\fB}{\mathfrak{B}}
\newcommand{\fC}{\mathfrak{C}}
\newcommand{\fD}{\mathfrak{D}}
\newcommand{\fE}{\mathfrak{E}}
\newcommand{\fF}{\mathfrak{F}}
\newcommand{\fG}{\mathfrak{G}}
\newcommand{\fH}{\mathfrak{H}}
\newcommand{\fI}{\mathfrak{I}}
\newcommand{\fJ}{{\bf\mathfrak{J}}}
\newcommand{\fK}{\mathfrak{K}}
\newcommand{\fL}{\mathfrak{L}}
\newcommand{\fM}{\mathfrak{M} \cfadd{multi}}
\newcommand{\fN}{\mathfrak{N}}
\newcommand{\fO}{\mathfrak{O}}
\newcommand{\fP}{\mathfrak{P}}
\newcommand{\fQ}{\mathfrak{Q}}
\newcommand{\fR}{\mathfrak{R}}
\newcommand{\fS}{\mathfrak{S}}
\newcommand{\fT}{\mathfrak{T}}
\newcommand{\fU}{\mathfrak{U}}
\newcommand{\fV}{\mathfrak{V}}
\newcommand{\fW}{\mathfrak{W}}
\newcommand{\fX}{\mathfrak{X}}
\newcommand{\fY}{\mathfrak{Y}}
\newcommand{\fZ}{\mathfrak{Z}}
\newcommand{\fa}{\mathfrak{a}}
\newcommand{\fb}{\mathfrak{b}}
\newcommand{\fc}{\mathfrak{c}}
\newcommand{\fd}{\mathfrak{d}}
\newcommand{\fe}{\mathfrak{e}}
\newcommand{\ff}{\mathfrak{f}}
\newcommand{\fg}{\mathfrak{g}}
\newcommand{\fh}{\mathfrak{h}}
%\newcommand{\fi}{\mathfrak{i}}
%\newcommand{\fj}{\mathfrak{j}}
\newcommand{\fk}{\mathfrak{k}}
\newcommand{\fl}{\mathfrak{l}}
\newcommand{\fm}{\mathfrak{m}}
\newcommand{\fn}{\mathfrak{n}}
\newcommand{\fo}{\mathfrak{o}}
\newcommand{\fp}{\mathfrak{p}}
\newcommand{\fq}{\mathfrak{q}}
\newcommand{\fr}{\mathfrak{r} \cfadd{rectifier}}
\newcommand{\fs}{\mathfrak{s}}
\newcommand{\ft}{\mathfrak{t}}
\newcommand{\fu}{\mathfrak{u}}
\newcommand{\fv}{\mathfrak{v}}
\newcommand{\fw}{\mathfrak{w}}
\newcommand{\fx}{\mathfrak{x}}
\newcommand{\fy}{\mathfrak{y}}
\newcommand{\fz}{\mathfrak{z}}
\newcommand{\bfa}{\mathbf{a}}
\newcommand{\bfb}{\mathbf{b}}
\newcommand{\bfc}{\mathbf{c}}
\newcommand{\bfd}{\mathbf{d}}
\newcommand{\bfe}{\mathbf{e}}
\newcommand{\bff}{\mathbf{f}}
\newcommand{\bfg}{\mathbf{g}}
\newcommand{\bfh}{\mathbf{h}}
\newcommand{\bfi}{\mathbf{i}}
\newcommand{\bfj}{\mathbf{j}}
\newcommand{\bfk}{\mathbf{k}}
\newcommand{\bfl}{\mathbf{l}}
\newcommand{\bfm}{\mathbf{m}}
\newcommand{\bfn}{\mathbf{n}}
\newcommand{\bfo}{\mathbf{o}}
\newcommand{\bfp}{\mathbf{p}}
\newcommand{\bfq}{\mathbf{q}}
\newcommand{\bfr}{\mathbf{r}}
\newcommand{\bfs}{\mathbf{s}}
\newcommand{\bft}{\mathbf{t}}
\newcommand{\bfu}{\mathbf{u}}
\newcommand{\bfv}{\mathbf{v}}
\newcommand{\bfw}{\mathbf{w}}
\newcommand{\bfx}{\mathbf{x}}
\newcommand{\bfy}{\mathbf{y}}
\newcommand{\bfz}{\mathbf{z}}
\newcommand{\bfA}{\mathbf{A}}
\newcommand{\bfB}{\mathbf{B}}
\newcommand{\bfC}{\mathbf{C}}
\newcommand{\bfD}{\mathbf{D}}
\newcommand{\bfE}{\mathbf{E}}
\newcommand{\bfF}{\mathbf{F}}
\newcommand{\bfG}{\mathbf{G}}
\newcommand{\bfH}{\mathbf{H}}
\newcommand{\bfI}{\mathbf{I}}
\newcommand{\bfJ}{\mathbf{J}}
\newcommand{\bfK}{\mathbf{K}}
\newcommand{\bfL}{\mathbf{L}}
\newcommand{\bfM}{\mathbf{M}}
\newcommand{\bfN}{\mathbf{N}}
\newcommand{\bfO}{\mathbf{O}}
\newcommand{\bfP}{\mathbf{P}}
\newcommand{\bfQ}{\mathbf{Q}}
\newcommand{\bfR}{\mathbf{R}}
\newcommand{\bfS}{\mathbf{S}}
\newcommand{\bfT}{\mathbf{T}}
\newcommand{\bfU}{\mathbf{U}}
\newcommand{\bfV}{\mathbf{V}}
\newcommand{\bfW}{\mathbf{W}}
\newcommand{\bfX}{\mathbf{X}}
\newcommand{\bfY}{\mathbf{Y}}
\newcommand{\bfZ}{\mathbf{Z}}
\newcommand{\scrA}{\mathscr{A}}
\newcommand{\scrB}{\mathscr{B}}
\newcommand{\scrC}{\mathscr{C}}
\newcommand{\scrD}{\mathscr{D}}
\newcommand{\scrE}{\mathscr{E}}
\newcommand{\scrF}{\mathscr{F}}
\newcommand{\scrG}{\mathscr{G}}
\newcommand{\scrH}{\mathscr{H}}
\newcommand{\scrI}{\mathscr{I}}
\newcommand{\scrJ}{\mathscr{J}}
\newcommand{\scrK}{\mathscr{K}}
\newcommand{\scrL}{\mathscr{L} \cfadd{def:lin_interp}}
\newcommand{\scrM}{\mathscr{M}}
\newcommand{\scrN}{\mathscr{N}}
\newcommand{\scrO}{\mathscr{O}}
\newcommand{\scrP}{\mathscr{P}}
\newcommand{\scrQ}{\mathscr{Q}}
\newcommand{\scrR}{\mathscr{R}}
\newcommand{\scrS}{\mathscr{S}}
\newcommand{\scrT}{\mathscr{T}}
\newcommand{\scrU}{\mathscr{U}}
\newcommand{\scrV}{\mathscr{V}}
\newcommand{\scrW}{\mathscr{W}}
\newcommand{\scrX}{\mathscr{X}}
\newcommand{\scrY}{\mathscr{Y}}
\newcommand{\scrZ}{\mathscr{Z}}
\newcommand{\LL}{\mathbb{L}}
\newcommand{\induct}{\dashrightarrow}
\newcommand{\with}{\curvearrowleft}
\newcommand{\lrSpace}{\ensuremath{\mkern-1.5mu}}
\newcommand{\eps}{\varepsilon}
\newcommand{\eg}{\unskip, e.g.,\ }
\newcommand{\Eg}{\unskip e.g.,\ }
\newcommand{\dpp}{\text{.}}
\newcommand{\dc}{\text{,}}
\newcommand{\dx}{\, {\rm d}}
\newcommand{\dxx}{{\rm d}}
\newcommand{\normmm}[1]{{\left\vert\kern-0.25ex\left\vert\kern-0.25ex\left\vert #1
\right\vert\kern-0.25ex\right\vert\kern-0.25ex\right\vert}
\cfadd{DNN_norm}}
\DeclarePairedDelimiter{\pr}{(}{)}
\DeclarePairedDelimiter{\br}{[}{]}
\DeclarePairedDelimiter{\cu}{\{}{\}}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert\cfadd{DNN_norm}}
\DeclarePairedDelimiter{\floor}{\lfloor}{\rfloor}
\DeclarePairedDelimiter{\ceil}{\lceil}{\rceil}
\DeclarePairedDelimiter{\vt}{\langle}{\rangle}
\newcommand{\N}{\ensuremath{\mathbb N}}
\newcommand{\Z}{\ensuremath{\mathbb Z}}
\newcommand{\Q}{\ensuremath{\mathbb Q}}
\newcommand{\R}{\ensuremath{\mathbb R}}
\newcommand{\C}{\ensuremath{\mathbb C}}
\newcommand{\E}{\ensuremath{\mathbb E}}
\renewcommand{\P}{\ensuremath{\mathbb P}}
\newcommand{\parallelization}{\operatorname{P} \cfadd{def:generalParallelization}}
\newcommand{\parallelizationSpecial}{\mathbf{P} \cfadd{def:simpleParallelization}}
\newcommand{\pa}[1]{\left({#1}\right)}
\newcommand{\Rr}{\mathcal{R}_\mathfrak{r} \cfadd{def:ANNrealization} \cfadd{rectifier}}
\newcommand{\Ra}{\mathcal{R}_a \cfadd{def:ANNrealization}}
\newcommand{\1}{\mathbbm{1}}
\newcommand{\ii}{\mathfrak{i} \cfadd{padding}}
\newcommand{\pu}{\mathfrak{u}}
\newcommand{\fj}{\mathfrak{x}}
\newcommand{\network}{neural network \cfadd{def:ANN2}}
\newcommand{\interpolatingDNN}{\mathbf{F}}
\newcommand{\AffineANN}{\cfadd{linear}\mathbf{A}}
\newcommand{\bbigANNsum}{\cfadd{def:ANNsum:same}\mathop{\oplus}\limits}
\newcommand{\scalarMultANN}[2]{\cfadd{def:ANNscalar}#1\circledast#2}
\newcommand{\interpol}[2]{\cfadd{def:lin_interp}\mathscr{L}_{#1}^{#2}}
\newcommand{\infnorm}[1]{\cfadd{def:p-norm}\norm{#1}_{\infty}}
\newcommand{\MappingStructuralToVectorized}{\cfadd{def:TranslateStructuredIntoVectorizedDescription}\mathcal{T}}
\newcommand{\pmat}[1]{\begin{pmatrix}#1\end{pmatrix}}
\newcommand{\fwpr}{W}
\newcommand{\fwprr}{W}
\newcommand{\smallU}{u}
\newcommand{\smallF}{f}
\newcommand{\funcF}{F}
\newcommand{\funcG}{g}
\newcommand{\boundFG}{\mathfrak{L}}
\newcommand{\LipConstF}{L}
\newcommand{\mlp}[3]{U_{#1}^{#2,#3}}
\newcommand{\Msymb}{\mathcal{M}}
\newcommand{\littleM}{m}
\newcommand{\littleMM}{m}
\newcommand{\funcM}{\phi}
\newcommand{\funcMrep}[1]{\max\{ k \in \N \colon k \le \exp( \abs{\ln(#1)}^{1/2} ) \}}
\newcommand{\cost}[3]{{\mathfrak{C}}_{#3,#1,#2}}
\newcommand{\firstConstant}[1]{\mathfrak{K}_{#1}}
\renewcommand{\fR}{\mathscr{n}}
\newcommand{\secondConstant}[1]{\firstConstant{#1}\sqrt{#1 -1}}
\newcommand{\maxfn}{\varphi}
\renewcommand{\AA}{\mathbb{A}}
\newcommand{\PP}{\mathbf{P}}
\newcommand{\BB}{\mathbb{B}}
\newcommand{\CC}{\mathbb{C}}
\newcommand{\A}{\mathbf{A} \cfadd{linear}}
\newcommand{\U}{\mathbf{U}}
\newcommand{\V}{\mathbf{V}}
\newcommand{\F}{\mathbf{F}}
\newcommand{\G}{\mathbf{G}}
\newcommand{\I}{\mathbf{I} \cfadd{def:id_net}}
\renewcommand{\H}{\mathbf{H}}
\newcommand{\NN}{\mathbf{N}}
\newcommand{\lbd}{u}
\newcommand{\ubd}{v}
\newcommand{\len}{n}
\newcommand{\weight}{W \cfadd{linear}}
\newcommand{\bias}{B \cfadd{linear}}
\newcommand{\ind}[1]{\mathbbm{1}_{\smash{#1}}}
\newcommand{\iind}[1]{\mathlarger{\mathbbm{1}}_{#1}}
\newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}}
\newcommand{\indicator}[1]{\mathbbm{1}_{\smash{#1}}}
% and in equations
\newcommand{\qandqShort}{\quad\text{and}\quad}
\newcommand{\andShort}{\text{ and }}
\newcommand{\forallDist}{\forall\,}
\newcommand{\identity}[1]{\mathrm{Id}_{#1}}
\newcommand{\smallsum}{\textstyle\sum}
\newcommand{\SmallSum}[2]{ {\textstyle\sum\limits_{#1}^{#2}}}
\newcommand{\idRelu}{\mathfrak I}
\newcommand{\Exists}{\exists\,}
\newcommand{\Forall}{\forall\,}
\newcommand{\mc}[1]{\mathcal{#1}}
\newcommand{\mf}[1]{\mathfrak{#1}}
\newcommand{\affineMap}{\mathbb{A}}
\newcommand{\idMatrix}{\operatorname{I} \cfadd{def:identityMatrix}}
\newcommand{\ANNs}{\mathbf{N} \cfadd{def:ANN}}
\newcommand{\MatrixANN}[1]{\mf N_{#1}}
\newcommand{\activation}{a}
\newcommand{\activationDim}[1]{\mathfrak{M}_{\activation,#1} \cfadd{multi}}
\newcommand{\functionANN}[1]{\mathcal{R}_{#1} \cfadd{def:ANNrealization}}
\newcommand{\paramANN}{\mathcal{P} \cfadd{def:ANN}}
\newcommand{\paramNotZeroANN}{\mathscr{P}}
\newcommand{\lengthANN}{\mathcal{L} \cfadd{def:ANN}}
\newcommand{\inDimANN}{\mathcal{I} \cfadd{def:ANN}}
\newcommand{\compANN}[2]{{#1 \bullet \allowbreak #2} \cfadd{def:ANNcomposition}}
\newcommand{\concANN}[2]{{#1 \odot #2}}
\newcommand{\concPsiANN}[2]{{#1 \odot_{\Psi} #2}}
\newcommand{\paraANN}[1]{\mathbf{P}_{#1}}
\newcommand{\paraLANN}[2]{\mathbf{P}_{#1,#2}}
\newcommand{\outDimANN}{\mathcal{O} \cfadd{def:ANN}}
\newcommand{\longerANN}[1]{\mathcal{E}_{#1} \cfadd{def:ANNenlargement}}
\newcommand{\idANN}[2]{\mathbb{I}_{#1,#2}}
\newcommand{\idANNshort}[1]{\mathbb{I}_{#1}}
\newcommand{\dims}{\mathcal{D} \cfadd{def:ANN}}
\newcommand{\hiddenLength}{\mathcal{H} \cfadd{def:ANN}}
\newcommand{\hiddenDimId}{\mathfrak{i}}
\newcommand{\qandq}{\qquad\text{and}\qquad}
\newcommand{\andq}{\text{and}\qquad}
\newcommand{\rect}{\mathfrak r \cfadd{rectifier}}
\newcommand{\Rect}{\mathfrak R}
\newcommand{\multdim}{\mathfrak M}
\DeclareMathOperator{\id}{id}
\newcommand{\matrixANN}[1]{\mathfrak{W}_{#1}}
\newcommand{\vectorANN}{\mathfrak{B}}
\newcommand{\sumANN}{\mathfrak{S} \cfadd{def:ANN:sum}}
\newcommand{\extensionANN}{\mathfrak{T} \cfadd{def:ANN:extension}}
\newcommand{\dimANNlevel}{\mathbb{D} \cfadd{def:ANN}}
\newcommand{\power}[2]{#1^{\bullet #2} \cfadd{def:iteratedANNcomposition}}
\newcommand{\scalar}[2]{ #1 \circledast #2 \cfadd{def:ANNscalar}}
\newcommand{\transpose}{* \cfadd{def:Transpose}}
\newcommand{\oSum}{\oplus \cfadd{def:ANNsum:same}}
\newcommand{\OSum}[2]{{\mathop\oplus\limits_{#1}^{#2} } \cfadd{def:ANNsum:same} }
\newcommand{\bSum}{{\mathop\boxplus} \cfadd{def:ANN:sum_diff}}
\newcommand{\BSum}[3]{{\mathop\boxplus\limits_{#1,#2}^{#3}} \cfadd{def:ANN:sum_diff}}
\newcommand{\modCont}{w \cfadd{mod_cont_def}}
\allowdisplaybreaks
\usepackage{scalerel,stackengine}
\newcommand\pig[1]{\scalerel*[5pt]{\big#1}{%
\ensurestackMath{\addstackgap[1.5pt]{\big#1}}}}
\newcommand\pigl[1]{\mathopen{\pig{#1}}}
\newcommand\pigr[1]{\mathclose{\pig{#1}}}
\newcommand\bpig[1]{\scalerel*[5pt]{\big#1}{%
\ensurestackMath{\addstackgap[1.5pt]{\big#1}}}}
\newcommand\bpigl[1]{\mathopen{\bpig{#1}}}
\newcommand\bpigr[1]{\mathclose{\bpig{#1}}}
%%%%%%%%%%%%%%%%%%%%%%%%
%%% Enum
%%%%%%%%%%%%%%%%%%%%%%%%
\ExplSyntaxOn
\NewDocumentCommand{\enum}{ O{;} m o }
{
\my_enum:nnn { #1 } { #2 } { #3 }
}
\seq_new:N \l__my_enum_seq
\tl_new:N \l__my_enum_item_tl
\prop_new:N \l__verbs
\prop_put:Nnn \l__verbs {show} {shows}
\prop_put:Nnn \l__verbs {imply} {implies}
\prop_put:Nnn \l__verbs {demonstrate} {demonstrates}
\prop_put:Nnn \l__verbs {prove} {proves}
\prop_put:Nnn \l__verbs {establish} {establishes}
\prop_put:Nnn \l__verbs {ensure} {ensures}
\prop_put:Nnn \l__verbs {assure} {assures}
\prop_put:Nnn \l__verbs {yield} {yields}
\int_new:N \l__number_of_args
\cs_new_protected:Nn \my_enum:nnn
{
%\seq_clear:N \l__my_enum_seq
%\clist_map_variable:nNn { #1 } \l__my_enum_item_tl
% {
% \__my_enum_add:V \l__my_enum_item_tl
% }
\seq_set_split:Nnn \l__my_enum_seq { #1 } { #2 }
\seq_remove_all:Nn \l__my_enum_seq {}
\int_set_eq:NN \l__number_of_args { \seq_count:N \l__my_enum_seq }
%triangle
%\int_compare:nF { \seq_count:N \l__my_enum_seq < 2 } { s }
%\nobreakspace
\seq_use:Nnnn \l__my_enum_seq { ~and~ } { ,~ } { ,~and~ }
\IfNoValueTF{#3}{}{
\space
\int_compare:nNnTF{ \l__number_of_args } < {2}{ \prop_item:Nn \l__verbs {#3} }{ #3 }
}
}
\ExplSyntaxOff
%%%%%%%%%%%%%%%%%%%%%%%%
%%% Automatic cf-lists
%%%%%%%%%%%%%%%%%%%%%%%%
\ExplSyntaxOn
\seq_new:N \g_cflist_loaded
\seq_new:N \g_cflist_pending
\NewDocumentCommand{\cfadd}{ m }
{
\seq_if_in:NnF \g_cflist_loaded { #1 } {
\seq_if_in:NnF \g_cflist_pending { #1 } {
\seq_gput_right:Nn \g_cflist_pending { #1 }
}
}
}
\NewDocumentCommand{\cfload}{ o }
{
\seq_if_empty:NTF \g_cflist_pending {\unskip} {
(cf.\ \cref{\seq_use:Nn \g_cflist_pending {,}})\IfValueTF{#1}{#1~}{\unskip}
\seq_gconcat:NNN \g_cflist_loaded \g_cflist_loaded \g_cflist_pending
\seq_gclear:N \g_cflist_pending
}
}
\NewDocumentCommand{\cfclear} {} {
\seq_gclear:N \g_cflist_loaded
\seq_gclear:N \g_cflist_pending
}
\NewDocumentCommand{\cfout}{ o }
{
\seq_if_empty:NTF \g_cflist_pending {\unskip} {
(cf.\ \cref{\seq_use:Nn \g_cflist_pending {,}})\IfValueTF{#1}{#1~}{\unskip}
\seq_gclear:N \g_cflist_pending
}
}
\NewDocumentCommand{\ifnocf} { m } {
\seq_if_empty:NT \g_cflist_pending { #1 }
}
\NewDocumentCommand{\cfconsiderloaded}{ m }{
\seq_gput_right:Nn \g_cflist_loaded {#1}
}
\ExplSyntaxOff
%%%%%%%%%%%%%%%%%%%%%%%%
%%% Automatic proof headers and endings, local labels
%%%%%%%%%%%%%%%%%%%%%%%%
\NewDocumentEnvironment {athm} {m m} {%
%\newenvironment{athm}[2]{%
\begin{#1}\label{#2}\global\def\loc{#2}%
}{%
\end{#1}%
}
\NewDocumentEnvironment{aproof} {} {%
\begin{proof}[Proof~of~\cref{\loc}]%
}{%
\finishproofthus
\end{proof}%
}
\ExplSyntaxOff
\newcommand{\eqqref}[1]{\cref{eq:\loc.#1}}
\newcommand{\eqlabel}[1]{\label{eq:\loc.#1}}
\newcommand{\finishproofthus}{The proof of \cref{\loc} is thus complete.}
\newcommand{\finishproofthis}{This completes the proof of \cref{\loc}.}
%%%%%%%%%%%%%%%%%%%%%%%%
%%% Flexible math displays
%%%%%%%%%%%%%%%%%%%%%%%%
\ExplSyntaxOn
\NewDocumentEnvironment{flexmath}{ m o }{
\str_if_eq:noTF {a} {#1} {
\begin{equation}
\IfValueT{#2}{\label{eq:\loc.#2}}
\begin{aligned}
} {
\catcode`&=9
\renewcommand{\\}{}
\str_if_eq:noTF {d} {#1} {
\begin{equation}
\IfValueT{#2}{\label{eq:\loc.#2}}
} {
\begin{math}
}
}
}{
\str_if_eq:noTF {i} {#1} {
\end{math}
\catcode`&=4
} {
\str_if_eq:noTF {d} {#1} {
\end{equation}
} {
\end{aligned}
\end{equation}
}
}
}
\ExplSyntaxOff
\ExplSyntaxOn
\bool_new:N \g_noteobserve
\NewDocumentCommand{\setnote}{}{
\bool_gset_true:N \g_noteobserve
}
\NewDocumentCommand{\setobserve}{}{
\bool_gset_false:N \g_noteobserve
}
\NewDocumentCommand{\nobs}{ o }{
\IfValueT{#1}{
\str_if_eq:noTF {note} {#1} {
\bool_gset_true:N \g_noteobserve
} {
\str_if_eq:noTF {Note} {#1} {
\bool_gset_true:N \g_noteobserve
} {
\bool_gset_false:N \g_noteobserve
}
}
}
\bool_if:nTF { \g_noteobserve } {
\bool_gset_false:N \g_noteobserve
note
} {
\bool_gset_true:N \g_noteobserve
observe
}
\IfValueF{#1}{~}
}
\NewDocumentCommand{\Nobs}{ o }{
\IfValueT{#1}{
\str_if_eq:noTF {note} {#1} {
\bool_gset_true:N \g_noteobserve
} {
\str_if_eq:noTF {Note} {#1} {
\bool_gset_true:N \g_noteobserve
} {
\bool_gset_false:N \g_noteobserve
}
}
}
\bool_if:nTF { \g_noteobserve } {
\bool_gset_false:N \g_noteobserve
Note
} {
\bool_gset_true:N \g_noteobserve
Observe
}
\IfValueF{#1}{~}
}
\bool_new:N \g_hencetherefore
\NewDocumentCommand{\hence}{ o }{
\IfValueT{#1}{
\str_if_eq:noTF {hence} {#1} {
\bool_gset_true:N \g_hencetherefore
} {
\str_if_eq:noTF {Hence} {#1} {
\bool_gset_true:N \g_hencetherefore
} {
\bool_gset_false:N \g_hencetherefore
}
}
}
\bool_if:nTF { \g_hencetherefore } {
\bool_gset_false:N \g_hencetherefore
hence
} {
\bool_gset_true:N \g_hencetherefore
therefore
}
\IfValueF{#1}{~}
}
\NewDocumentCommand{\Hence}{ o }{
\IfValueT{#1}{
\str_if_eq:noTF {hence} {#1} {
\bool_gset_true:N \g_hencetherefore
} {
\str_if_eq:noTF {Hence} {#1} {
\bool_gset_true:N \g_hencetherefore
} {
\bool_gset_false:N \g_hencetherefore
}
}
}
\bool_if:nTF { \g_hencetherefore } {
\bool_gset_false:N \g_hencetherefore
Hence
} {
\bool_gset_true:N \g_hencetherefore
Therefore
}
\IfValueF{#1}{~}
}
\int_new:N \g_furthermore
\NewDocumentCommand{\Moreover}{ o o }{
\IfValueT{#1}{
\str_case:nn {#1} {
{Next} {\int_gset:Nn {\g_furthermore} {0}}
{Furthermore} {\int_gset:Nn {\g_furthermore} {1}}
{Moreover} {\int_gset:Nn {\g_furthermore} {2}}
{In~addition} {\int_gset:Nn {\g_furthermore} {3}}
{note} {\bool_gset_true:N \g_noteobserve}
{observe} {\bool_gset_false:N \g_noteobserve}
}
\IfValueT{#2}{
\str_case:nn {#2} {
{Next} {\int_gset:Nn {\g_furthermore} {0}}
{Furthermore} {\int_gset:Nn {\g_furthermore} {1}}
{Moreover} {\int_gset:Nn {\g_furthermore} {2}}
{In~addition} {\int_gset:Nn {\g_furthermore} {3}}
{note} {\bool_gset_true:N \g_noteobserve}
{observe} {\bool_gset_false:N \g_noteobserve}
}
}
}
\int_case:nn { \int_mod:nn {\g_furthermore} {4} } {
{ 0 } { Next,~\nobs that}
{ 1 } { Furthermore,~\nobs that}
{ 2 } { Moreover,~\nobs that}
{ 3 } { In~addition,~\nobs that}
}
\int_gincr:N \g_furthermore
\IfValueF{#1}{~}
}
\ExplSyntaxOff
\ExplSyntaxOn
\int_new:N \g_enumit
\NewDocumentCommand{\Enum}{ m o }{
\IfValueT{#2}{
\str_case:nn {#2} {
{ensure} {\int_gset:Nn {\g_enumit} {0}}
{ensures} {\int_gset:Nn {\g_enumit} {0}}
{assure} {\int_gset:Nn {\g_enumit} {1}}
{assures} {\int_gset:Nn {\g_enumit} {1}}
{prove} {\int_gset:Nn {\g_enumit} {2}}
{proves} {\int_gset:Nn {\g_enumit} {2}}
{show} {\int_gset:Nn {\g_enumit} {3}}
{shows} {\int_gset:Nn {\g_enumit} {3}}
{demonstrate} {\int_gset:Nn {\g_enumit} {4}}
{demonstrates} {\int_gset:Nn {\g_enumit} {4}}
{yield} {\int_gset:Nn {\g_enumit} {5}}
{yields} {\int_gset:Nn {\g_enumit} {5}}
{establish} {\int_gset:Nn {\g_enumit} {6}}
{establishes} {\int_gset:Nn {\g_enumit} {6}}
{imply} {\int_gset:Nn {\g_enumit} {7}}
{implies} {\int_gset:Nn {\g_enumit} {7}}
}
}
\int_case:nn { \int_mod:nn {\g_enumit} {8} } {
{ 0 } { \enum{ #1 }[ensure]{ } }
{ 1 } { \enum{ #1 }[assure] }
{ 2 } { \enum{ #1 }[prove] }
{ 3 } { \enum{ #1 }[show] }
{ 4 } { \enum{ #1 }[demonstrate] }
{ 5 } { \enum{ #1 }[yield] }
{ 6 } { \enum{ #1 }[establish] }
{ 7 } { \enum{ #1 }[imply] }
}
\int_gincr:N \g_enumit
}
\ExplSyntaxOff