%% Copyright (C) 2016-2019 Tommi Höynälänmaa

\newcommand{\theme}{Theme-D}
\newcommand{\defterm}[1]{\textit{#1}}
\newcommand{\code}[1]{\texttt{#1}}
\newcommand{\myurl}[1]{#1}
\newcommand{\inhsymb}{\(:<\)}
\newcommand{\minhsymb}{:<}
\newcommand{\inherits}[2]{{#1} \inhsymb\ {#2}}
\newcommand{\imminhsymb}{\(::<\)}
\newcommand{\mimminhsymb}{::<}
\newcommand{\imminh}[2]{{#1} \imminhsymb\ {#2}}
%%\newcommand{\keyword}[1]{{\ttfamily{}{\bfseries{}{#1}}}}
\newcommand{\keyword}[1]{\textrm{\bfseries{}{#1}}}
\newcommand{\ckeyword}[1]{\textrm{\bfseries{}{#1}}}
\newcommand{\skeyword}[1]{\textrm{\bfseries{}{#1}}}
\newcommand{\macro}[1]{\textrm{\bfseries{}{#1}}}
\newcommand{\builtin}[1]{\code{#1}}
\newcommand{\cbuiltin}[1]{\code{#1}}
\newcommand{\obuiltin}[1]{\code{#1}}
\newcommand{\sbuiltin}[1]{\code{#1}}
\newcommand{\mbuiltin}[1]{\code{#1}}
\newcommand{\typeparam}[1]{{\%{#1}}}
\newcommand{\sldots}{...}
\newcommand{\oldots}{...}
\newcommand{\nan}{NaN}
\newcommand{\myln}{\ln}

\newcommand{\syntaxmath}[1]{\({#1}\)}
\newcommand{\syntaxdefequal}{\(::=\)}
\newcommand{\syntaxelement}[1]{\textrm{#1}}
\newcommand{\syntaxor}{\(\vert\)\ }
\newcommand{\syntaxopt}[1]{{[}{#1}{]}}
\newcommand{\syntaxvar}[1]{{\rmfamily{}\textit{#1}}}
\newcommand{\indexedsyntaxvar}[2]{{\rmfamily{}\(\textit{#1}_{#2}\)}}
\newenvironment{syntaxblock}%
{\par\vspace{0.5cm}\noindent}%
{\vspace{0.5cm}\par\noindent}
\newenvironment{syntaxformula}{}{}
\newcommand{\syntaxformulacmd}[1]{#1}
\newcommand{\syntaxvarf}[1]{\syntaxformulacmd{\syntaxvar{#1}}}
\newcommand{\indexedsyntaxvarf}[2]{\syntaxformulacmd{\indexedsyntaxvar{#1}{#2}}}
\newcommand{\syntaxspace}{\ }
\newcommand{\syntaxelementf}[1]{\syntaxformulacmd{\syntaxelement{#1}}}

\newcommand{\objectvar}[1]{{\rmfamily{}\textit{#1}}}
\newcommand{\mobjectvar}[1]{{\textit{#1}}}
\newcommand{\indexedobjectvar}[2]{{\rmfamily{}\(\textit{#1}_{#2}\)}}
\newcommand{\indexedmobjectvar}[2]{{\mathit{#1}_{#2}}}
\newenvironment{objectblock}%
{\par\vspace{0.5cm}\noindent}%
{\vspace{0.5cm}\par\noindent}
\newenvironment{objectformula}{}{}
\newcommand{\objectformulacmd}[1]{#1}
\newcommand{\objectvarf}[1]{\objectformulacmd{\objectvar{#1}}}
\newcommand{\indexedobjectvarf}[2]{\objectformulacmd{\indexedobjectvar{#1}{#2}}}
\newcommand{\objectspace}{\ }

\newcommand{\tupletype}{:tuple}
\newenvironment{arglist}{\noindent}{}
\newcommand{\procarg}[1]{\code{#1}}
\newcommand{\proctypearg}[1]{\(\textrm{\syntaxvar{#1}}\)}
%% syntax parentheses
\newcommand{\slp}{\texttt{(}}
\newcommand{\srp}{\texttt{)}}
%% list parentheses in math mode
\newcommand{\mlistlp}{\texttt{(}}
\newcommand{\mlistrp}{\texttt{)}}
%% metaparentheses
\newcommand{\mlp}{\textrm{\{}}
\newcommand{\mrp}{\textrm{\}}}
\newcommand{\olp}{\texttt{(}}
\newcommand{\orp}{\texttt{)}}
\newcommand{\indexedprocarg}[2]{\code{{#1}-{#2}}}
\newcommand{\indexedproctypearg}[2]{\({\textrm{\syntaxvar{#1}}}_{#2}\)}
\newcommand{\argument}[3]{\newline \mbox{ }\hspace{0.5cm} Name: %
  \procarg{#1}\newline \mbox{ }\hspace{0.5cm} Type: {#2}\newline %
  \mbox{ }\hspace{0.5cm} Description: {#3}\newline}
\newcommand{\argumentnodesc}[2]{\newline \mbox{ }\hspace{0.5cm} Name: %
  \procarg{#1}\newline \mbox{ }\hspace{0.5cm} Type: {#2}\newline}
\newcommand{\indexedargument}[4]{\newline \mbox{ }\hspace{0.5cm} Name: %
  \indexedprocarg{#1}{#2}\newline \mbox{ }\hspace{0.5cm} Type: {#3}\newline %
  \mbox{ }\hspace{0.5cm} Description: {#4}\newline}
\newcommand{\typeargument}[3]{\newline \mbox{ }\hspace{0.5cm} Name: %
  \proctypearg{#1}\newline \mbox{ }\hspace{0.5cm} Type: {#2}\newline %
  \mbox{ }\hspace{0.5cm} Description: {#3}\newline}
\newcommand{\indexedtypeargument}[4]{\newline \mbox{ }\hspace{0.5cm} Name: %
  \indexedproctypearg{#1}{#2}\newline \mbox{ }\hspace{0.5cm} Type: {#3}\newline %
  \mbox{ }\hspace{0.5cm} Description: {#4}\newline}
\newcommand{\procresult}[2]{\noindent \textit{Result value}: %
  {#1}\newline %
  \textit{Result type:} %
  {#2}\newline}
\newcommand{\noprocresult}{\par\noindent{}No result value.\newline}
\newcommand{\startprocsyntax}{\noindent\textit{Syntax:}}
\newcommand{\startprocarguments}{\noindent{}\textit{Arguments:}\newline}
\newcommand{\noprocarguments}{\par\noindent{}No arguments.\newline}
\newcommand{\typeparams}[1]{\par\noindent{}\textit{Type parameters:} %
  {\ttfamily{#1}}\vspace{0.5cm}}
\newcommand{\procpurity}[1]{\par\noindent{}\textit{Purity of the %
    procedure: }{#1}\vspace{0.5cm}}
\newcommand{\startmacrosyntax}{\noindent\textit{Syntax:}}
\newcommand{\precondition}[1]{\par\noindent{}\textit{Precondition: }%
  {#1}\vspace{0.5cm}}
% \newcommand{\cindtop}{\hspace{1cm}}
% \newcommand{\cind}{\hspace{0.5cm}}
\newcommand{\cindtop}{\;\;\;\;}
\newcommand{\cind}{\;\;}
\newcommand{\algorithmname}[1]{\textsf{#1}}
\newcommand{\algappllparen}{[}
\newcommand{\algapplrparen}{]}
\newcommand{\alglistlparen}{(}
\newcommand{\alglistrparen}{)}
\newcommand{\algapplylparen}{(}
\newcommand{\algapplyrparen}{)}
\newcommand{\algorithmappl}[2]{\algorithmname{#1}\algappllparen{}{#2}\algapplrparen}
% \newenvironment{codeblock}%
% {\vspace{0.5cm}\hspace{0.5cm}\noindent}%
% {\vspace{0.5cm}}
\newenvironment{codeblock}%
{\par\vspace{0.5cm}\ttfamily}%
{\vspace{0.5cm}\par}
% \newenvironment{codeblock}{\begin{verbatim}}{\end{verbatim}}
\newenvironment{codeformula}{\ttfamily}{}
\newcommand{\codeformulacmd}[1]{{\ttfamily{}#1}}

\newcommand{\indexedprocargf}[2]{\syntaxformulacmd{\indexedprocarg{#1}{#2}}}
\newenvironment{arglistdeclcode}%
{\par\noindent{}\textit{Argument list declaration:}\begin{codeblock}}%
{\end{codeblock}}
\newenvironment{resultdeclcode}%
{\par\noindent{}\textit{Result type declaration:}\begin{codeblock}}%
{\end{codeblock}}
\newenvironment{datatype}{\par\noindent}{}
\newcommand{\datatypename}[1]{\par\noindent\textit{Data type name: }{\code{#1}}%
\index{\code{#1}}}
\newcommand{\datatypetype}[1]{\par\noindent\textit{Type: }{#1}}
\newcommand{\datatypenrparams}[1]{\par\noindent\textit{Number of type %
    parameters: }{#1}}
\newcommand{\datatypedesc}[1]{\par\noindent\textit{Description: }{#1}}
\newcommand{\datatypedef}[1]{\par\noindent\textit{Definition: }{\code{#1}}}
%% \newcommand{\setvarsym}{\(\leftarrow\)}
\newcommand{\setvarsym}{:=}
\newcommand{\setvar}[2]{{#1} \setvarsym\ {#2}}
\newcommand{\algdefequal}{\setvarsym}
\newcommand{\snot}{\(\lnot\)}
\newcommand{\setsep}{:}
\newcommand{\sta}{\indexedobjectvarf{t}{1}}
\newcommand{\stb}{\indexedobjectvarf{t}{2}}
\newcommand{\true}{\code{\#t}}
\newcommand{\false}{\code{\#f}}
\newcommand{\algresult}{Result:}
\newcommand{\algarguments}{Arguments:}
\newcommand{\noalgresult}{\par\noindent{}\textit{No result value.}\newline}
\newenvironment{ifblock}{}{}
\newcommand{\truewithmp}{\(\mlistlp \true\ M' \mlistrp\)}
\newcommand{\falsewithmp}{\(\mlistlp \false\ M' \mlistrp\)}
\newcommand{\truewithm}{\(\mlistlp \true\ M \mlistrp\)}
\newcommand{\falsewithm}{\(\mlistlp \false\ M \mlistrp\)}
\newcommand{\objectvartp}{\(t'\)}
\newcommand{\objectvarup}{\(u'\)}
\newcommand{\objectvarcapmp}{\(M'\)}
\newcommand{\vprime}{\(v'\)}
\newcommand{\attrlistdef}%
  {\syntaxvar{attribute-list} \syntaxdefequal \slp%
  \syntaxvar{attribute} ... \srp \syntaxor \syntaxvar{attribute} \\%
  \syntaxvar{attribute} \syntaxdefequal%
  \code{pure} \syntaxor \code{nonpure} \syntaxor \code{force-pure} \\%
  \indent%
  \syntaxor \code{always-returns} \syntaxor \code{may-return}%
  \syntaxor \code{never-returns}}
\newcommand{\attrlistdefb}%
  {\syntaxvar{attribute-list} \syntaxdefequal \slp%
  \syntaxvar{attribute} ... \srp \\%
  \syntaxvar{attribute} \syntaxdefequal%
  \code{pure} \syntaxor \code{nonpure} \\%
  \indent%
  \syntaxor \code{always-returns} \syntaxor \code{may-return}%
  \syntaxor \code{never-returns}}
\newcommand{\cl}[1]{\noindent\mbox{ }\hspace{#1}}
\newcommand{\bl}{\(\backslash\)}
\newcommand{\condarrow}{\(=>\)}
\newcommand{\macrodef}[1]{\vspace{1cm}\noindent{\Large{\macro{#1}}}%
  \vspace{0.5cm}\index{\macro{#1}}}
\newcommand{\macrodefa}[1]{\noindent{\Large{\macro{#1}}}%
  \index{\macro{#1}}\newline}
\newcommand{\procdef}[1]{\vspace{1cm}\noindent{\Large{\code{#1}}}%
  \vspace{0.5cm}\index{\code{#1}}}
\newcommand{\procdefexcl}[2]{\vspace{1cm}\noindent{\Large{\code{#1}}}%
  \vspace{0.5cm}\index{\code{#2}}}
\newcommand{\procdefa}[1]{\noindent{\Large{\code{#1}}}%
  \index{\code{#1}}\newline}
\newcommand{\puremethoddefwithvalue}[4]{\code{#1}: \code{(#2)} %
  \(\to\) \code{#3} pure %
  \hspace{1em} = \hspace{1em} \code{#4}\newline}
\newcommand{\methoddefwithvalue}[4]{\code{#1}: \code{(#2)} %
  \(\to\) \code{#3} %
  \hspace{1em} = \hspace{1em} \code{#4}\newline}
\newcommand{\puremethoddef}[3]{\code{#1}: \code{(#2)} \(\to\) \code{#3} pure%
  \newline}
\newcommand{\methoddef}[3]{\code{#1}: \code{(#2)} %
  \(\to\) \code{#3} \newline}
\newcommand{\abstpuremethoddef}[3]{\code{#1}: \code{(#2)} \(\to\) \code{#3}%
  \hspace{1em} pure abstract\newline}
\newcommand{\abstmethoddef}[3]{\code{#1}: \code{(#2)} \(\to\) \code{#3}%
  \hspace{1em} abstract\newline}
\newcommand{\indexmethod}[1]{\index{\code{#1}}}
\newcommand{\shortpureprocdef}[3]{\code{#1}: \code{(#2)} \(\to\) \code{#3} pure%
  \index{\code{#1}} \newline}
\newcommand{\shortprocdef}[3]{\code{#1}: \code{(#2)} \(\to\) \code{#3}%
  \newline}

\DeclareMathOperator{\erf}{erf}
\DeclareMathOperator{\erfc}{erfc}
