\par
\section{Prototypes and descriptions of methods in the {\tt
Misc} directory}
\label{section:Misc:proto}
\par
This section contains brief descriptions including prototypes
of all methods in the {\tt Misc} directory.
\par
%=======================================================================
\subsection{Theoretical nested dissection methods}
\begin{enumerate}
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void mkNDperm ( int n1, int n2, int n3, int newToOld[], int west,
                int east, int south, int north, int bottom, int top ) ;
\end{verbatim}
\index{mkNDperm@{\tt mkNDperm()}}
This method this vector fills a permutation vector with the
nested dissection
new-to-old ordering of the vertices for the subgrid defined by
nodes whose coordinates lie in
\begin{verbatim}
[west, east] x [south, north] x [bottom, top].
\end{verbatim}
The method calls itself recursively.
To find the permutation for an {\tt n1 x n2 x n3} grid, call
\begin{verbatim}
mkNDperm(n1, n2, n3, newToOld, 0, n1-1, 0, n2-1, 0, n3-1) ;
\end{verbatim}
from a driver program.
\par \noindent {\it Error checking:}
If {\tt n1}, {\tt n2} or {\tt n3} are less than or equal to zero,
or if {\tt newToOld} is {\tt NULL},
or if {\tt west}, {\tt south} or {\tt bottom}
are less than or equal to zero,
of if ${\tt east} \ge {\tt n1}$,
of if ${\tt north} \ge {\tt n2}$,
of if ${\tt top} \ge {\tt n3}$,
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void mkNDperm2 ( int n1, int n2, int n3, int newToOld[], int west,
                 int east, int south, int north, int bottom, int top ) ;
\end{verbatim}
\index{mkNDperm2@{\tt mkNDperm2()}}
This method this vector fills a permutation vector with the
nested dissection
new-to-old ordering of the vertices for the subgrid defined by
nodes whose coordinates lie in
\begin{verbatim}
[west, east] x [south, north] x [bottom, top].
\end{verbatim}
There is one important difference between this method and {\tt
mkNDperm()} above; this method finds {\it double-wide} separators,
necessary for an operator with more than nearest neighbor grid
point coupling.
The method calls itself recursively.
To find the permutation for an {\tt n1 x n2 x n3} grid, call
\begin{verbatim}
mkNDperm(n1, n2, n3, newToOld, 0, n1-1, 0, n2-1, 0, n3-1) ;
\end{verbatim}
from a driver program.
\par \noindent {\it Error checking:}
If {\tt n1}, {\tt n2} or {\tt n3} are less than or equal to zero,
or if {\tt newToOld} is {\tt NULL},
or if {\tt west}, {\tt south} or {\tt bottom}
are less than or equal to zero,
of if ${\tt east} \ge {\tt n1}$,
of if ${\tt north} \ge {\tt n2}$,
of if ${\tt top} \ge {\tt n3}$,
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void localND2D ( int n1, int n2, int p1, int p2,
                 int dsizes1[], int dsizes2[], int oldToNew[] ) ;
\end{verbatim}
\index{localND2D@{\tt localND2D()}}
This method finds a local nested dissection ordering
\cite{bha93-localND} for an {\tt n1 x n2} 2-D grid.
There are {\tt p1 x p2} domains in the grid.
The {\tt dsizes1[]} and {\tt dsizes2[]} vectors are optional;
they allow the user to explicitly input domain sizes.
If {\tt dsizes1[]} and {\tt dsizes2[]} are not {\tt NULL},
the {\tt q = q1 + q2*p1}'th domain contains a
{\tt dsizes1[q1] x dsizes2[q2]} subgrid of points.
\par \noindent {\it Error checking:}
If {\tt n1} or {\tt n2} are less than or equal to zero,
or if {\tt p1} or {\tt p2} are less than or equal to zero,
or if $2{\tt p1} - 1 > {\tt n1}$,
or if $2{\tt p2} - 1 > {\tt n2}$,
or if {\tt oldToNew} is {\tt NULL},
or if {\tt dsizes1[]} and {\tt dsizes2[]} are not {\tt NULL}
but have invalid entries (all entries must be positive,
entries in {\tt dsizes1[]} must sum to {\tt n1 - p1 + 1},
and
entries in {\tt dsizes2[]} must sum to {\tt n2 - p2 + 1},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void localND3D ( int n1, int n2, int n3, int p1, int p2, int p3,
                 int dsizes1[], int dsizes2[], int dsizes3[],
                 int oldToNew[] ) ;
\end{verbatim}
\index{localND3D@{\tt localND3D()}}
This method finds a local nested dissection ordering
\cite{bha93-localND} for an {\tt n1 x n2 x n3} 3-D grid.
There are {\tt p1 x p2 x p3} domains in the grid.
The {\tt q}'th domain contains a
{\tt dsizes1[q] x dsizes2[q] x dsizes3[q]}
subgrid of points.
The {\tt dsizes1[]}, {\tt dsizes2[]} and {\tt dsizes3[]} vectors
are optional;
they allow the user to explicitly input domain sizes.
If {\tt dsizes1[]}, {\tt dsizes2[]} and {\tt dsizes3[]}
are not {\tt NULL},
the {\tt q = q1 + q2*p1+ q3*p1*p2}'th domain contains a
{\tt dsizes1[q1] x dsizes2[q2] x disizes3[q3]} subgrid of points.
\par \noindent {\it Error checking:}
If {\tt n1}, {\tt n2} or {\tt n3} are less than or equal to zero,
or if {\tt p1}, {\tt p2} or {\tt p3} are less than or equal to zero,
or if $2{\tt p1} - 1 > {\tt n1}$,
or if $2{\tt p2} - 1 > {\tt n2}$,
or if $2{\tt p3} - 1 > {\tt n3}$,
or if {\tt oldToNew} is {\tt NULL},
or if {\tt dsizes1[]}, {\tt disizes2[]} and {\tt dsizes3[]}
are not {\tt NULL}
but have invalid entries (all entries must be positive,
entries in {\tt dsizes1[]} must sum to {\tt n1 - p1 + 1},
entries in {\tt dsizes2[]} must sum to {\tt n2 - p2 + 1},
and
entries in {\tt dsizes3[]} must sum to {\tt n3 - p3 + 1},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void fp2DGrid ( int n1, int n2, int ivec[], FILE *fp ) ;
\end{verbatim}
\index{fp2DGrid@{\tt fp2DGrid()}}
This method writes the {\tt ivec[]} vector onto an {\tt n1 x n2}
grid to file {\tt fp}.
This is useful to visualize an ordering or a metric on a grid.
\par \noindent {\it Error checking:}
If {\tt n1} or {\tt n2} are less than or equal to zero,
or if {\tt ivec} or {\tt fp} are {\tt NULL},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void fp3DGrid ( int n1, int n2, int n3, int ivec[], FILE *fp ) ;
\end{verbatim}
\index{fp3DGrid@{\tt fp3DGrid()}}
This method writes the {\tt ivec[]} vector onto an {\tt n1 x n2 x n3}
grid to file {\tt fp}.
This is useful to visualize an ordering or a metric on a grid.
\par \noindent {\it Error checking:}
If {\tt n1}, {\tt n2} or {\tt n3} are less than or equal to zero,
or if {\tt ivec} or {\tt fp} are {\tt NULL},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\end{enumerate}
\par
%=======================================================================
\subsection{Multiple minimum degree, Nested dissection
            and multisection wrapper methods}
\par
There are three simple methods to find minimum degree, nested
dissection and multisection orderings.
In addition, there is one method that finds the better of two
methods -- nested dissection and multisection.
(Much of the work to find either nested dissection or multisection
is identical, so this method takes little more time than either of
the two separately.)
\par
To properly specify these methods there are many parameters
--- these three wrapper methods insulate the user from all but one
or two of the parameters.
As a result, the quality of the ordering may not be as good as can
be found by using non-default settings of the parameters.
\par
One wrapper method computes a minimum degree ordering --- the only
input parameter is a random number seed.
Two wrappers methods compute the nested dissection and multisection
orderings --- in addition to a random number seed there is a upper
bound on the subgraph size used during the graph partition.
This is the most sensitive of the parameters.
\par
The user interested in more customized orderings should consult the
chapters on the
the {\tt GPart}, {\tt DSTree} and {\tt MSMD} objects
that perform the three steps of the ordering process:
perform an incomplete nested dissection of the graph,
construct the map from vertices to stages in which they will be
eliminated, and perform the multi-stage minimum degree ordering.
The driver programs in the {\tt GPart} and {\tt MSMD} directories
fully exercise the graph partition and ordering strategies by
giving the user access to all input parameters.
\par
\begin{enumerate}
%-----------------------------------------------------------------------
\item
\begin{verbatim}
ETree * orderViaMMD ( Graph *graph, int seed, int msglvl, FILE *msgFile ) ;
\end{verbatim}
\index{orderViaMMD@{\tt orderViaMMD()}}
This method returns a front tree {\tt ETree} object for a multiple
minimum degree ordering of the graph {\tt graph}.
The {\tt seed} parameter is a random number seed.
The {\tt msglvl} and {\tt msgFile} parameters govern the
diagnostics output.
Use {\tt msglvl = 0} for no output, {\tt msglvl = 1} for timings
and scalar statistics, and use {\tt msglvl > 1} with care, for it
can generate huge amounts of output.
\par \noindent {\it Error checking:}
If {\tt graph} is {\tt NULL},
or if {\tt msglvl > 0} and {\tt msgFile} is {\tt NULL},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
ETree * orderViaND ( Graph *graph, int maxdomainsize, int seed,
                     int msglvl, FILE *msgFile ) ;
\end{verbatim}
\index{orderViaND@{\tt orderViaND()}}
This method returns a front tree {\tt ETree} object for a nested
dissection ordering of the graph {\tt graph}.
If a subgraph has more vertices than the {\tt maxdomainsize} parameter,
it is split.
The {\tt seed} parameter is a random number seed.
The {\tt msglvl} and {\tt msgFile} parameters govern the
diagnostics output.
Use {\tt msglvl = 0} for no output, {\tt msglvl = 1} for timings
and scalar statistics, and use {\tt msglvl > 1} with care, for it
can generate huge amounts of output.
\par \noindent {\it Error checking:}
If {\tt graph} is {\tt NULL},
or if ${\tt maxdomainsize} \le 0$,
or if {\tt msglvl > 0} and {\tt msgFile} is {\tt NULL},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
ETree * orderViaMS ( Graph *graph, int maxdomainsize, int seed,
                     int msglvl, FILE *msgFile ) ;
\end{verbatim}
\index{orderViaMS@{\tt orderViaMS()}}
This method returns a front tree {\tt ETree} object for a
multisection ordering of the graph {\tt graph}.
If a subgraph has more vertices than the {\tt maxdomainsize} parameter,
it is split.
The {\tt seed} parameter is a random number seed.
The {\tt msglvl} and {\tt msgFile} parameters govern the
diagnostics output.
Use {\tt msglvl = 0} for no output, {\tt msglvl = 1} for timings
and scalar statistics, and use {\tt msglvl > 1} with care, for it
can generate huge amounts of output.
\par \noindent {\it Error checking:}
If {\tt graph} is {\tt NULL},
or if ${\tt maxdomainsize} \le 0$,
or if {\tt msglvl > 0} and {\tt msgFile} is {\tt NULL},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
ETree * orderViaBestOfNDandMS ( Graph *graph, int maxdomainsize, int maxzeros,
                                int maxsize, int seed, int msglvl, FILE *msgFile ) ;
\end{verbatim}
\index{orderViaBestOfNDandMS@{\tt orderViaBestOfNDandMS()}}
This method returns a front tree {\tt ETree} object for a
better of two orderings, a nested dissection
and multisection ordering.
If a subgraph has more vertices than the {\tt maxdomainsize} parameter,
it is split.
The {\tt seed} parameter is a random number seed.
This method also transforms the front tree using the {\tt maxzeros}
and {\tt maxsize} parameters.
See the {\tt ETree\_transform()} method
in Section~\ref{subsection:ETree:proto:transformation}.
The {\tt msglvl} and {\tt msgFile} parameters govern the
diagnostics output.
Use {\tt msglvl = 0} for no output, {\tt msglvl = 1} for timings
and scalar statistics, and use {\tt msglvl > 1} with care, for it
can generate huge amounts of output.
\par \noindent {\it Error checking:}
If {\tt graph} is {\tt NULL},
or if ${\tt maxdomainsize} \le 0$,
or if {\tt msglvl > 0} and {\tt msgFile} is {\tt NULL},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\end{enumerate}
\par
%=======================================================================
\subsection{Graph drawing method}
\par
\begin{enumerate}
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void drawGraphEPS ( Graph *graph, Coords *coords, IV *tagsIV,
                    double bbox[4], double rect[4], double linewidth1,
                    double linewidth2, double radius, char *epsFileName,
                    int msglvl, FILE *msgFile ) ;
\end{verbatim}
\index{drawGraphEPS@{\tt drawGraphEPS()}}
This method is used to create an EPS (Encapsulated Postscript) file
that contains a picture of a graph in two dimensions.
We use this to visualize separators and domain decompositions,
mostly of regular grids and triangulations of a planar region.
\par
The {\tt graph} object defines the connectivity of the
vertices.
The {\tt coords} object defines the locations of the vertices.
The {\tt tagsIV} object is used to define whether or not an edge
is drawn between two vertices adjacent in the graph.
When {\tt tagsIV} is not {\tt NULL},
if there is an edge {\tt (u,v)} in the graph and
{\tt tags[u] = tags[v]}, then the edge with width {\tt linewidth1}
is drawn.
For edges {\tt (u,v)} in the graph and
{\tt tags[u] != tags[v]}, then the edge with width {\tt linewidth2}
is drawn, assuming ${\tt linewidth2} > 0$.
If {\tt tagsIV} is {\tt NULL}, than all edges are drawn with
width {\tt linewidth1}.
Each vertex is draw with a filled circle with radius {\tt radius}.
\par
The graph and its {\tt Coords} object occupy a certain area in 2-D
space.
We try to plot the graph inside the area defined by the {\tt
rect[]} array in such a manner that the relative scales are
preserved (the graph is not stretched in either the $x$ or $y$
direction) and that the larger of the width and height of the graph
fills the area defined by the {\tt rect[]} rectangle.
{\it Note}: hacking postscript is {\it not} an area of expertise of
either author.
Some Postscript viewers give us messages that we are not obeying
the format conventions (this we do not doubt), but we have never
failed to view or print one of these files.
\par \noindent {\it Error checking:}
If the method is unable to open the file,
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\end{enumerate}
\par
%=======================================================================
\subsection{Linear system construction}
\par
Our driver programs test linear systems where the matrices come
from regular grids using nested dissection orderings.
There are two methods that generate linear systems of this form
along with the front tree and symbolic factorization.
\par
\begin{enumerate}
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void mkNDlinsys ( int n1, int n2, int n3, int maxzeros, int maxsize,
                  int type, int symmetryflag, int nrhs, int seed, int msglvl,
                  FILE *msgFile, ETree **pfrontETree, IVL **psymbfacIVL,
                  InpMtx **pmtxA, DenseMtx **pmtxX, DenseMtx **pmtxB ) ;
\end{verbatim}
\index{mkNDlinsys@{\tt mkNDlinsys()}}
This method creates a linear system $AX = B$ for a
${\tt n1} \times {\tt n2} \times {\tt n3}$ grid.
The entries in $A$ and $X$ are random numbers,
$B$ is computed as the product of $A$ with $X$.
$A$ can be real ({\tt type = 1}) or complex ({\tt type = 2}),
and can be symmetric ({\tt symmetryflag = 0}),
Hermitian ({\tt symmetryflag = 1}) or
nonsymmetric ({\tt symmetryflag = 2}).
The number of columns of $X$ is given by {\tt nrhs}.
The linear system is ordered using theoretical nested dissection,
and the front tree is transformed using the {\tt maxzeros} and {\tt
maxsize} parameters.
The addresses of the front tree, symbolic factorization, and three
matrix objects are returned in the last five arguments of the
calling sequence.
\par \noindent {\it Error checking:}
None presently.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void mkNDlinsysQR ( int n1, int n2, int n3, int type, int nrhs, int seed,
               int msglvl, FILE *msgFile, ETree **pfrontETree, IVL **psymbfacIVL,
               InpMtx **pmtxA, DenseMtx **pmtxX, DenseMtx **pmtxB ) ;
\end{verbatim}
\index{mkNDlinsysQR@{\tt mkNDlinsysQR()}}
This method creates a linear system $AX = B$ for a
natural factor formulation of a
${\tt n1} \times {\tt n2} \times {\tt n3}$ grid.
If {\tt n1}, {\tt n2} and {\tt n3} are all greater than 1,
the grid is formed of linear hexahedral elements and
the matrix $A$ has {\tt 8*n1*n2*n3} rows.
If one of {\tt n1}, {\tt n2} and {\tt n3} is equal to 1,
the grid is formed of linear quadrilateral elements and
the matrix $A$ has {\tt 4*n1*n2*n3} rows.
The entries in $A$ and $X$ are random numbers,
$B$ is computed as the product of $A$ with $X$.
$A$ can be real ({\tt type = 1}) or complex ({\tt type = 2}).
The number of columns of $X$ is given by {\tt nrhs}.
The linear system is ordered using theoretical nested dissection,
and the front tree is transformed using the {\tt maxzeros} and {\tt
maxsize} parameters.
The addresses of the front tree, symbolic factorization, and three
matrix objects are returned in the last five arguments of the
calling sequence.
\par \noindent {\it Error checking:}
None presently.
%-----------------------------------------------------------------------
\end{enumerate}


\documentclass[namecite, fleqn]{goose-article}

\title{Isotropic elasto-plasticity}

\author{Tom W.J.\ de Geus}

\hypersetup{pdfauthor={T.W.J. de Geus}}

\newcommand\leftstar[1]{\hspace*{-.3em}~^\star\!#1}

\begin{document}

\maketitle

\begin{abstract}
\noindent
History dependent elasto-plastic material.
This corresponds to a non-linear relation between the Cauchy stress, $\bm{\sigma}$,
and the linear strain increment, $\bm{\varepsilon}_\Delta$,
depending on the equivalent plastic strain, $\varepsilon_\mathrm{p}$.
I.e.
\begin{equation*}
    \bm{\sigma}
    = f ( \bm{\varepsilon}_\Delta , \varepsilon_\mathrm{p} )
\end{equation*}
The plasticity follows power-law hardening
\begin{equation*}
    \sigma_\mathrm{y} (\varepsilon_\mathrm{p})
    = \sigma_\mathrm{y0} + \varepsilon_\mathrm{p}^n
\end{equation*}
The model is implemented in 3-D, hence it can directly be used for either 3-D
or 2-D plane strain problems.
\end{abstract}

\section{Constitutive model}

The model consists of the following ingredients:
\begin{enumerate}[(i)]

    \item The strain, $\bm{\varepsilon}$, is additively split in an elastic part,
    $\bm{\varepsilon}_\mathrm{e}$, and a plastic plastic, $\bm{\varepsilon}_\mathrm{p}$.
    I.e.
    \begin{equation}
        \bm{\varepsilon} \equiv \bm{\varepsilon}_\mathrm{e} + \bm{\varepsilon}_\mathrm{p}
    \end{equation}

    \item The stress, $\bm{\sigma}$, is set by to the elastic strain,
    $\bm{\varepsilon}_\mathrm{e}$, through the following linear relation:
    \begin{equation}
        \bm{\sigma} \equiv \mathbb{C}_\mathrm{e} : \bm{\varepsilon}_\mathrm{e}
    \end{equation}
    wherein $\mathbb{C}_\mathrm{e}$ is the elastic stiffness, which reads:
    \begin{align}
        \mathbb{C}_\mathrm{e}
        &\equiv K \bm{I} \otimes \bm{I}
        + 2 G (\mathbb{I}_\mathrm{s} - \tfrac{1}{3} \bm{I} \otimes \bm{I} )
        \\
        &= K \bm{I} \otimes \bm{I}
        + 2 G \, \mathbb{I}_\mathrm{d}
    \end{align}
    with $K$ and $G$ the bulk and shear modulus respectively.
    See \cref{sec:ap:nomenclature} for nomenclature,
    including definitions of the unit tensors.

    \item The elastic domain is bounded by the following yield function
    \begin{equation}
        \Phi( \bm{\sigma} , \varepsilon_\mathrm{p} )
        \equiv \sigma_\mathrm{eq} - \sigma_\mathrm{y} (\varepsilon_\mathrm{p}) \leq 0
    \end{equation}
    where $\sigma_\mathrm{eq}$ the equivalent stress (see \cref{sec:ap:stress}),
    and $\sigma_\mathrm{y}$ the yield stress which is a non-linear function of
    the equivalent plastic strain, $\varepsilon_\mathrm{p}$.

    \item To determine the direction of plastic flow, normality is assumed.
    This corresponds to the following associative flow rule:
    \begin{equation}
        \dot{\bm{\varepsilon}}_\mathrm{p} \equiv \dot{\gamma} \bm{N}
    \end{equation}
    where $\dot{\gamma}$ is the plastic multiplier, and $\bm{N}$ is the Prandtl--Reuss flow vector,
    which is defined through normality:
    \begin{equation}
        \bm{N} \equiv \frac{\partial \Phi}{\partial \bm{\sigma}}
        = \sqrt{\frac{3}{2}} \;
        \frac{\bm{\sigma}_\mathrm{d}}{|| \bm{\sigma}_\mathrm{d} ||}
        = \frac{3}{2}
        \frac{\bm{\sigma}_\mathrm{d}}{\sigma_\mathrm{eq}}
    \end{equation}

    \item Finally, associative hardening is assumed:
    \begin{equation}
        \dot{\varepsilon}_\mathrm{p}
        \equiv \sqrt{\tfrac{2}{3}} \; \big|\big| \dot{\bm{\varepsilon}}_\mathrm{p} \big|\big|
        = \dot{\gamma}
    \end{equation}
    The equivalent plastic strain then reads
    \begin{equation}
        \varepsilon_\mathrm{p}
        = \int\limits_0^t \dot{\varepsilon}_\mathrm{p} ~\mathrm{d}\tau
    \end{equation}

\end{enumerate}
For a more detailed description the reader is referred to \citet[][p.\ 216-234]{DeSouzaNeto2008}.

\section{Numerical implementation: implicit}

For the numerical implementation, first of all
a numerical time integration scheme has to be selected.
Here, an implicit time discretisation is used, which has the
favourable property of being unconditionally stable.
The numerical implementation of it is done by the commonly used return-map algorithm,
in which an increment in strain is first assumed fully elastic (elastic predictor).
Then, if needed, a return-map is utilized to return to a physically admissible state
(plastic corrector).

\subsection{Elastic predictor}

Given an increment in strain
\begin{equation}
    \bm{\varepsilon}_\Delta
    = \bm{\varepsilon} - \bm{\varepsilon}^{(t)}
\end{equation}
and the state variables, evaluate the \emph{elastic trial state}:
\begin{align}
    \leftstar{\bm{\varepsilon}}_\mathrm{e}
    &= \bm{\varepsilon}_\mathrm{e}^{(t)} + \bm{\varepsilon}_\Delta
    \\
    \leftstar{\varepsilon}_\mathrm{p}
    &= \varepsilon_\mathrm{p}^{(t)}
\end{align}
The corresponding trial stress is computed by
\begin{equation}
    \leftstar{\bm{\sigma}}
    = \mathbb{C}_\mathrm{e} : \leftstar{\bm{\varepsilon}}_\mathrm{e}
\end{equation}
Finally the trial value of the yield function follows as
\begin{equation}
    \leftstar{\Phi}
    = \Phi( \leftstar{\bm{\sigma}} , \leftstar{\varepsilon}_\mathrm{p} )
    = \leftstar{\sigma}_\mathrm{eq}
    - \sigma_\mathrm{y} (\leftstar{\varepsilon}_\mathrm{p})
\end{equation}

\subsection{Trial state: elastic}

If the trial state is within the (current) yield surface, i.e.\ when
\begin{equation}
    \leftstar{\Phi} \leq 0
\end{equation}
the trial state coincides with the actual state, and:
\begin{align}
    \bm{\varepsilon}_\mathrm{e}
    &= \leftstar{\bm{\varepsilon}}_\mathrm{e}
    = \bm{\varepsilon}_\mathrm{e}^{(t)} + \bm{\varepsilon}_\Delta
    \\
    \varepsilon_\mathrm{p}
    &= \leftstar{\varepsilon}_\mathrm{p}
    = \varepsilon_\mathrm{p}^{(t)}
    \\
    \bm{\sigma}
    &= \leftstar{\bm{\sigma}}
\end{align}

Otherwise a return-map is needed (see below).

\subsection{Trial state elasto-plastic: return-map}

If the trial state is outside the (current) yield surface, i.e.\ when
\begin{equation}
    \leftstar{\Phi} > 0
\end{equation}
plastic flow occurs in the increment.
A return-map is needed to return to the admissible state.
The admissible state has to satisfy the following system of equations:
\begin{equation}
    \begin{cases}
        \; \bm{\varepsilon}_\mathrm{e}
        &= \leftstar\bm{\varepsilon}_\mathrm{e}
        - \Delta \gamma \; \bm{N}
        \\[2mm]
        \; \varepsilon_\mathrm{p}
        &= \varepsilon_\mathrm{p}^{(t)} + \Delta \gamma
        \\[2mm]
        \; \Phi
        &= \sigma_\mathrm{eq}
        - \sigma_\mathrm{y} \big( \varepsilon_\mathrm{p}^{(t)} + \Delta\gamma \big)
        = 0
    \end{cases}
\end{equation}

\subsubsection{Scalar equation return-map}

This can be reduced by using that
\begin{align}
    \bm{\sigma}_\mathrm{d}
    &= \leftstar{\bm{\sigma}}_\mathrm{d}
     - 2 G \Delta \gamma \; \bm{N}
    \\
    &= \leftstar{\bm{\sigma}}_\mathrm{d}
    - 3 G \Delta \gamma \;
    \frac{
        \bm{\sigma}_\mathrm{d}
    }{
        \sigma_\mathrm{eq}
    }
\end{align}
From this is follows that:
\begin{equation}
    \frac{\bm{\sigma}_\mathrm{d}}{\sigma_\mathrm{eq}}
    = \frac{\leftstar{\bm{\sigma}}_\mathrm{d}}{\leftstar{\sigma}_\mathrm{eq}}
    \qquad
    \text{or}
    \qquad
    \bm{N}
    = \leftstar{\bm{N}}
\end{equation}
And thus
\begin{equation}
    \bm{\sigma}_\mathrm{d}
    = \left( 1 - \frac{3 G \Delta \gamma}{\leftstar{\sigma}_\mathrm{eq}} \right)
    \leftstar{\bm{\sigma}}_\mathrm{d}
\end{equation}
whereby the equivalent stress trivially follows as
\begin{equation}
    \sigma_\mathrm{eq} =
    \leftstar{\sigma}_\mathrm{eq} - 3 G \Delta \gamma
\end{equation}
In stead of the system return the plastic multiplier $\Delta \gamma$ can directly
be found by enforcing the yield surface
\begin{equation}
\label{eq:return-scalar}
    \Phi
    = \leftstar{\sigma}_\mathrm{eq}
    - 3 G \Delta \gamma
    - \sigma_\mathrm{y} \big( \varepsilon_\mathrm{p}^{(t)} + \Delta \gamma \big)
    = 0
\end{equation}
This (non-linear) equation has to be solved for the unknown plastic multiplier $\Delta \gamma$.

\subsubsection{Linear hardening}

Linear hardening reads
\begin{equation}
    \sigma_\mathrm{y} = \sigma_\mathrm{y0} + H \varepsilon_\mathrm{p}
\end{equation}
In this case \cref{eq:return-scalar} can be solved analytically.
The solution reads
\begin{equation}
    \Delta \gamma
    = \frac{ \leftstar{\Phi} }{ 3G + H }
\end{equation}

\subsubsection{Non-linear hardening}

\begin{enumerate}[(1)]

    \item Initial guess:
    \begin{equation}
        \Delta \gamma
        := 0
    \end{equation}
    and evaluate
    \begin{equation}
        \tilde{\Phi}
        := \leftstar{\Phi}
    \end{equation}

    \item Perform Newton-Raphson iteration:
    \begin{itemize}

    \item Hardening slope
    \begin{equation}
        H
        := \left.
        \frac{
            \mathrm{d} \sigma_\mathrm{y}
        }{
            \mathrm{d} \varepsilon_\mathrm{p}
        }
        \right|_{\varepsilon_\mathrm{p}^{(t)} + \Delta \gamma}
    \end{equation}

    \item Residual derivative:
    \begin{equation}
        d := \frac{\mathrm{d} \tilde{\Phi}}{\mathrm{d} \Delta \gamma}
        = -3G - H
    \end{equation}

    \item Update guess for the plastic multiplier:
    \begin{equation}
        \Delta \gamma := \Delta \gamma - \frac{\tilde{\Phi}}{d}
    \end{equation}
    \end{itemize}

    \item Check for convergence:
    \begin{equation}
        \tilde{\Phi}
        := \leftstar{\sigma}_\mathrm{eq}
        - 3 G \Delta \gamma
        - \sigma_\mathrm{y} ( \varepsilon_\mathrm{p}^{(t)} + \Delta \gamma )
    \end{equation}
    Stop if:
    \begin{equation}
        \big| \tilde{\Phi} \big| \leq \epsilon_\mathrm{tol}
    \end{equation}
    Otherwise continue with (2)

\end{enumerate}

\subsubsection{Trial state update}

Finally, the trial state is updated:
\begin{itemize}

    \item The updated stress tensor
    \begin{equation}
        \bm{\sigma}
        = \sigma_\mathrm{m} \bm{I}
        + \bm{\sigma}_\mathrm{d}
    \end{equation}
    with
    \begin{align}
        \sigma_\mathrm{m}
        &= \leftstar{\sigma}_\mathrm{m}
        \\
        \bm{\sigma}_\mathrm{d}
        &= \left(
            1 - \frac{3 G \Delta \gamma}{\leftstar{\sigma}_\mathrm{eq}}
        \right) \leftstar{\bm{\sigma}}_\mathrm{d}
    \end{align}

    \item The updated elastic strain tensor
    \begin{equation}
        \bm{\varepsilon}_\mathrm{e}
        = \frac{1}{2G} \bm{\sigma}_\mathrm{d}
        + \tfrac{1}{3} \;\mathrm{tr} (\leftstar{\bm{\varepsilon}}) \bm{I}
    \end{equation}

    \item The updated equivalent plastic strain:
    \begin{equation}
        \varepsilon_\mathrm{p}
        = \varepsilon_\mathrm{p}^{(t)}
        + \Delta \gamma
    \end{equation}

\end{itemize}

\section{Consistent tangent}

To derive the consistent tangent, the first step is to combine the above to an explicit
relation between the (actual) stress $\bm{\sigma}$ and the trial elastic strain
$\leftstar{\bm{\varepsilon}}_\mathrm{e}$.
\begin{itemize}

    \item If elastic:
    \begin{equation}
        \bm{\sigma}
        = \leftstar{\bm{\sigma}}
        = \mathbb{C}_\mathrm{e} : \leftstar{\bm{\varepsilon}}_\mathrm{e}
    \end{equation}
    The tangent then trivially follows:
    \begin{equation}
        \mathbb{C}_\mathrm{ep}
        =
        \frac{
            \partial  \bm{\sigma} \hfill
        }{
            \partial \bm{\varepsilon} \hfill
        }
        =
        \frac{
            \partial ~\bm{\sigma} \hfill
        }{
            \partial \;\leftstar{\bm{\varepsilon}}_\mathrm{e} \hfill
        }
        =
        \mathbb{C}_\mathrm{e}
    \end{equation}

    \item If plastic:
    \begin{align}
        \bm{\sigma}
        &= \sigma_\mathrm{m} \bm{I}
        + \bm{\sigma}_\mathrm{d}
        \\
        &= \leftstar{\sigma}_\mathrm{m} \bm{I}
        + \left( 1- \frac{3 G \Delta \gamma}{\leftstar{\sigma}_\mathrm{eq}} \right)
        \leftstar{\bm{\sigma}}_\mathrm{d}
        \\
        &= \leftstar{\sigma}_\mathrm{m} \bm{I}
        + \left( 1-\frac{3 G \Delta\gamma}{\leftstar{\sigma}_\mathrm{eq}} \right)
        2 G \; \leftstar{\bm{\varepsilon}}_\mathrm{e}^\mathrm{d}
        \\
        &=
        \left[
        \mathbb{C}_\mathrm{e} -
        \frac{6 G^2 \Delta \gamma}{\leftstar{\sigma}_\mathrm{eq}} \, \mathbb{I}_\mathrm{d}
        \right] : \leftstar{\bm{\varepsilon}}_\mathrm{e}
    \end{align}
    The tangent then follows from
    \begin{align}
        \mathbb{C}_\mathrm{ep} &=
        \frac{
            \partial  \bm{\sigma} \hfill
        }{
            \partial \bm{\varepsilon} \hfill
        } =
        \frac{
            \partial ~\bm{\sigma} \hfill
        }{
            \partial \;\leftstar{\bm{\varepsilon}}_\mathrm{e} \hfill
        }
        \\
        &=
        \mathbb{C}_\mathrm{e} -
        \frac{6 G^2 \Delta \gamma}{\leftstar{\sigma}_\mathrm{eq}}
        \mathbb{I}_\mathrm{d}
        + 4 G^2
        \left[
            \frac{\Delta \gamma}{\leftstar{\sigma}_\mathrm{eq}} -
            \frac{1}{3 G + H}
        \right]
        \leftstar{\bm{N}} \otimes \leftstar{\bm{N}}
    \end{align}

\end{itemize}

\subsection{Derivation}

\begin{align}
    \frac{
        \partial \bm{\sigma} \hfill
    }{
        \partial \leftstar{\bm{\varepsilon}}_\mathrm{e} \hfill
    } =
    \mathbb{C}^e
    - \frac{6 G^2 \Delta \gamma}{\leftstar{\sigma}_\mathrm{eq}} \mathbb{I}^d
    - \frac{6 G^2}{\leftstar{\sigma}_\mathrm{eq}} \;
    \left( \frac{
        \partial ~\Delta \gamma \hfill
    }{
        \partial \leftstar{\bm{\varepsilon}}_\mathrm{e} \hfill
    } \right) \otimes
    \leftstar{\bm{\varepsilon}}_\mathrm{e}^d
    + \frac{6 G^2 \Delta \gamma}{\leftstar{\sigma}_\mathrm{eq}^2} \;
    \left( \frac{
        \partial \leftstar{\sigma}_\mathrm{eq} \hfill
    }{
        \partial \leftstar{\bm{\varepsilon}}_\mathrm{e} \hfill
    } \right) \otimes
    \leftstar{\bm{\varepsilon}}_\mathrm{e}^d
\end{align}
Apply the following:
\begin{itemize}

\item for the equivalent stress
\begin{equation}
    \frac{\partial \sigma_\mathrm{eq}}{\partial \bm{\sigma}}
    = \frac{\partial \sigma_\mathrm{eq}}{\partial \bm{\sigma}^d}
    = \frac{\partial}{\partial \bm{\sigma}^d }
    \left( \sqrt{ \tfrac{3}{2} \bm{\sigma}^d : \bm{\sigma}^d } \right)
    = \frac{1}{2 \sigma_\mathrm{eq} } \frac{\partial}{\partial \bm{\sigma}^d}
    \left( \tfrac{3}{2} \bm{\sigma}^d : \bm{\sigma}^d \right)
    = \frac{3}{2} \frac{\bm{\sigma}^d}{\sigma_\mathrm{eq}} = \bm{N} = \leftstar{\bm{N}}
\end{equation}
hence:
\begin{equation}
    \frac{
        \partial \leftstar{\sigma}_\mathrm{eq}
    }{
        \partial \leftstar{\bm{\varepsilon}}_\mathrm{e}
    } =
    2 G \, \leftstar{\bm{N}}
\end{equation}

\item for the plastic multiplier
\begin{align}
    \frac{
        \partial ~\Delta \gamma \hfill
    }{
        \partial  \leftstar{\bm{\varepsilon}}_\mathrm{e}  \hfill
    }
    =
    \left( \frac{
        \partial ~\Delta \gamma \hfill
    }{
        \partial ~\Phi \hfill
    } \right) \;
    \left( \frac{
        \partial \,~\Phi \hfill
    }{
        \partial  \,\leftstar{\sigma}_\mathrm{eq} \hfill
    } \right) \;
    \left( \frac{
        \partial \,\leftstar{\sigma}_\mathrm{eq} \hfill
    }{
        \partial \,\leftstar{\bm{\varepsilon}}_\mathrm{e} \hfill
    } \right) \;
    &= \frac{2 G}{3 G + H} \, \leftstar{\bm{N}}
\end{align}
\end{itemize}

\appendix

\section{Nomenclature}
\label{sec:ap:nomenclature}

\paragraph{Tensor products}
\vspace*{.5eM}

\begin{itemize}

    \item Dyadic tensor product
    \begin{align}
        \mathbb{C} &= \bm{A} \otimes \bm{B} \\
        C_{ijkl} &= A_{ij} \, B_{kl}
    \end{align}

    \item Double tensor contraction
    \begin{align}
        C &= \bm{A} : \bm{B} \\
        &= A_{ij} \, B_{ji}
    \end{align}

\end{itemize}

\paragraph{Tensor decomposition}
\vspace*{.5eM}

\begin{itemize}

    \item Deviatoric part $\bm{A}_\mathrm{d}$ of an arbitrary tensor $\bm{A}$:
    \begin{equation}
        \mathrm{tr}\left( \bm{A}_\mathrm{d} \right) \equiv 0
    \end{equation}
    and thus
    \begin{equation}
      \bm{A}_\mathrm{d} = \bm{A} - \tfrac{1}{3} \mathrm{tr}\left( \bm{A} \right)
    \end{equation}

\end{itemize}

\paragraph{Fourth order unit tensors}
\vspace*{.5eM}

\begin{itemize}

    \item Unit tensor:
    \begin{equation}
        \bm{A} \equiv \mathbb{I} : \bm{A}
    \end{equation}
    and thus
    \begin{equation}
        \mathbb{I} = \delta_{il} \delta{jk}
    \end{equation}

    \item Right-transposition tensor:
    \begin{equation}
        \bm{A}^T \equiv \mathbb{I}^{RT} : \bm{A} = \bm{A} : \mathbb{I}^{RT}
    \end{equation}
    and thus
    \begin{equation}
        \mathbb{I}^{RT} = \delta_{ik} \delta_{jl}
    \end{equation}

    \item Symmetrisation tensor:
    \begin{equation}
        \mathrm{sym} \left( \bm{A} \right) \equiv \mathbb{I}_\mathrm{s} : \bm{A}
    \end{equation}
    whereby
    \begin{equation}
        \mathbb{I}_\mathrm{s} = \tfrac{1}{2} \left( \mathbb{I} + \mathbb{I}^{RT} \right)
    \end{equation}
    This follows from the following derivation:
    \begin{align}
        \mathrm{sym} \left( \bm{A} \right) &= \tfrac{1}{2} \left( \bm{A} + \bm{A}^T \right)
        \\
        &= \tfrac{1}{2} \left( \mathbb{I} : \bm{A} + \mathbb{I}^{RT} : \bm{A} \right)
        \\
        &= \tfrac{1}{2} \left( \mathbb{I} + \mathbb{I}^{RT} \right) : \bm{A}
        \\
        &= \mathbb{I}_\mathrm{s} : \bm{A}
    \end{align}

    \item Deviatoric and symmetric projection tensor
    \begin{equation}
        \mathrm{dev} \left( \mathrm{sym}
        \left( \bm{A} \right) \right) \equiv \mathbb{I}_\mathrm{d} : \bm{A}
    \end{equation}
    from which it follows that:
    \begin{equation}
        \mathbb{I}_\mathrm{d}
        = \mathbb{I}_\mathrm{s} - \tfrac{1}{3} \bm{I} \otimes \bm{I}
    \end{equation}

\end{itemize}

\section{Stress measures}
\label{sec:ap:stress}

\begin{itemize}

    \item Mean stress
    \begin{equation}
        \sigma_\mathrm{m}
        = \tfrac{1}{3} \, \mathrm{tr} ( \bm{\sigma} )
        = \tfrac{1}{3} \, \bm{\sigma} : \bm{I}
    \end{equation}

    \item Stress deviator
    \begin{equation}
        \bm{\sigma}_\mathrm{d}
        = \bm{\sigma} - \sigma_\mathrm{m} \, \bm{I}
        = \mathbb{I}_\mathrm{d} : \bm{\sigma}
    \end{equation}

    \item Von Mises equivalent stress
    \begin{align}
        \sigma_\mathrm{eq}
        = \sqrt{ \tfrac{3}{2} \, \bm{\sigma}_\mathrm{d} : \bm{\sigma}_\mathrm{d} }
        = \sqrt{ 3 J_2(\bm{\sigma}) }
    \end{align}
    where the second-stress invariant
    \begin{align}
        J_2 = \tfrac{1}{2} \, || \, \bm{\sigma}_\mathrm{d} \, ||^2
        = \tfrac{1}{2} \, \bm{\sigma}_\mathrm{d} : \bm{\sigma}_\mathrm{d}
    \end{align}

\end{itemize}

\scriptsize
\bibliography{library}

\end{document}


\section{Comparison with Dijkstra}\label{sec:comparison}

The Dijkstra algorithm tries to find a minimum \emph{spanning} tree (to be more
precise, a shortest path tree) which contains links that connect a set of target
nodes.

Differently from that, a minimum \emph{Steiner} tree algorithm, as the dual
ascent is, considers also other non-target nodes to compute the solution. So in
this way the lower bound of the optimal solution is less or equal than the
result provided by a \emph{spanning} tree algorithm (as we can see in
\figref{fig:steiner}). The price to pay is in term of time and computational
power, because the algorithm has to visit all the possible links and not the
subset that involves only the target nodes, so this solution has a limited
scalability.

\begin{figure}
	\centering
	\begin{subfigure}[b]{0.3\textwidth}
		\centering
		\includegraphics[width=\textwidth]{img/steiner-topology}
		\caption{An example of a network topology where black nodes are
		target nodes}\label{subfig:steiner-topology}
	\end{subfigure}
	\begin{subfigure}[b]{0.3\textwidth}
		\centering
		\includegraphics[width=\textwidth]{img/steiner-minspanning}
		\caption{The result of a minimum spanning tree algorithm on the
		example network topology. The result only contains links that
		involve target nodes. Its cost is
		4}\label{subfig:steiner-minspanning}
	\end{subfigure}
	\begin{subfigure}[b]{0.3\textwidth}
		\centering
		\includegraphics[width=\textwidth]{img/steiner-minsteiner}
		\caption{The result of a minimum Steiner tree algorithm on the
		example network topology. It includes also non-target nodes to
		build the tree. Its cost is 3}\label{subfig:steiner-minsteiner}
	\end{subfigure}
	\caption{An example of application of a minimum spanning tree algorithm
		and a minimum Steiner tree algorithm on the same
		topology}\label{fig:steiner}
\end{figure}


\documentclass[letterpaper]{article}

\usepackage{fullpage}
\usepackage{nopageno}
\usepackage{amsmath}
\usepackage{amssymb}
\allowdisplaybreaks

\newcommand{\abs}[1]{\left\lvert #1 \right\rvert}

\begin{document}
\title{Notes}
\date{September 5, 2014}
\maketitle
\section*{7}
$680=2^3\cdot5\cdot17, 2^3\cdot5+17=57, m,n=40,17$
\section*{8}
\begin{align*}
  (h,k)=m\\
  m|dh\rightarrow m|a\\
  m|dk\rightarrow m|b\\
\end{align*}
\section*{12}
\begin{align*}
  (a,b)=1\\
  (a,c)=1\\
  \Leftrightarrow\\
  (a,[b,c])=1
\end{align*}
\section*{19}
p,q are twin primes, provethat pq+1 is square iff p,q are twin primes

\begin{align*}
  q=p+2\\
  pq+1=p(p+2)+1=p^2+2p+1=(p+1)^2\\
  m^2=pq+1\\
  mm-1=pq
  (m+1)(m-1)=pq\\
  (a+1)=pq, or 1 or p
  (a-1)=1, or pq, or q
\end{align*}
\section*{23}
$x^m-1=(x-1)(x^{m-1}+x^{m-2}+...+x+1)$

$x^{2k+1}+1=(x+1)(x^{2k}-x^{2k-1}+x^{2k-2}-...+x^2-x+1)$

$2^n+1$ is prime is given. n is a power of two iff prime factorization of n is $2^m$. prove by contradiction. assume there exists $p=2k+1$ that divides n. $n=(2k+1)\cdot q$.

\begin{align*}
  2^n+1=2^{q(2k+1)}\\
  =(2^{q})^{2k+1}=(2^q+1)(2^{q2k}-2^{q(2k-1)}+...+1)
\end{align*}
now $2^n+1$ is not prime unless $p=1$ and $p$ is prime
\section*{last time}
$a,n\in\mathbb{Z}, n>1$ the equation $ax\equiv 1 \mod n$ has a solution iff $(a,n)=1$.

\section*{thm}
$a,b,n\in\mathbb{Z},n>1$
\begin{enumerate}
\item
the only eq $ax\equiv b\mod n$ has a solution iff $d|b$ where $d=\gcd(a,n)$.
\item
assume that $d|b$ then the integer solutions of the equation are of the form $...x-\frac{2n}{d},x-\frac{n}{d},x,x+\frac{n}{d},x+\frac{2n}{d},...$, in particular modulo n, there exist exactly d distinct solutions,namely $x,x+\frac{n}{d},x+\frac{2n}{d},...,x+\frac{(d-1)n}{d}$
\end{enumerate}
\subsection*{proof}
assume that $ax\equiv  b\mod n$ has a solutionn. then there exist $\alpha,q\in\mathbb{Z}$ such that $a\alpha-b=nq$. this implies that $b=a\alpha-nq\rightarrow d|b$ because $d|a\alpha$ and $d|nq$

assume $d|b$. then $b=d\beta$ for some $\beta\in\mathbb{Z}$
\begin{align*}
  b=(as+nt)\beta, s,t\in\mathbb{Z}\\
  as\beta\equiv b\mod n\rightarrow s\beta\text{ is a solution}
\end{align*}

assume $d|b$, let $m=\frac{n}{d}$. claim $\alpha$ solution $\rightarrow\alpha+km$ solution for all $k\in\mathbb{Z}$.
\subsubsection*{proof of claim}
$\alpha$ solution$\Rightarrow a\alpha\equiv b\mod n$ but $a(\alpha+km)=a\alpha+akm$ and $akm=ak\frac{n}{d}=n\frac{a}{d}k\in\mathbb{Z}$ so $akm\equiv a\alpha\equiv b \mod n$

to finish we need to prove the following:

if $\alpha,\beta$  are solutions then $\beta-\alpha$ is a multiple of m.
\begin{align*}
  a\alpha\equiv b\mod n\\
  a\beta\equiv b\mod n\\
  a\alpha \equiv a\beta\mod n\\
  n|a(\beta-\alpha)\\
  n=md\\
  md|a(\beta-\alpha)\\
  a=a'd\\
  md|a'd(\beta-\alpha)\\
  m|a'(\beta-\alpha)
\end{align*}
if we know that gcd of $m$ and $a'$ is one then $m|(\beta-\alpha)$. we know it is because $md=n$  and $a=a'd$ and d is gcd of $a,n$ so if there were another divisor then d wouldn't be the gcd, it would be pd.

\section*{chinese remainder theorem}
$m,n\in\mathbb{Z}^+$ then the system $x\equiv a\mod n, x\equiv b\mod m$ has an integer solution iff m and n are relatively prime. moreover, any two solutions are congruent modulo mn.

\subsection*{proof}
m,n are relatively prime, write $m\alpha+\beta n=1$, let $x=a\alpha m+b\beta n$ then $x\equiv a\alpha m\equiv a\mod n$ because $\alpha m$ is congruent to 1. and $x\equiv b\beta n\equiv b\mod m$
\section*{exercises}
second part of chinese remainder theorem
\end{document}


\documentclass{memoir}
\usepackage{notestemplate}

%\logo{~/School-Work/Auxiliary-Files/resources/png/logo.png}
%\institute{Rice University}
%\faculty{Faculty of Whatever Sciences}
%\department{Department of Mathematics}
%\title{Class Notes}
%\subtitle{Based on MATH xxx}
%\author{\textit{Author}\\Gabriel \textsc{Gress}}
%\supervisor{Linus \textsc{Torvalds}}
%\context{Well, I was bored...}
%\date{\today}

\begin{document}

% \maketitle

% Notes taken on 05/10/21

\begin{thm}
	Let \(K / \mathbb{F}_p\) be a field extension of the prime subfield \(\mathbb{F}_p\).
	\begin{itemize}
		\item If \(K\) is finite, then \(\left| K \right| = p^{n}\) for some positive integer \(n\).
		\item \(\left| K \right| = p^{n}\) if and only if \(K\) is the splitting field of \(x^{p^{n}}-x\) over \(\mathbb{F}_p\).
	\end{itemize}
	By the uniqueness of splitting fields, we can simply denote \(K\) by \(\mathbb{F}_{p^{n}}\).
\end{thm}
This theorem gives us a complete characterization of finite fields. The first part is proven in Dummitt-Foote 13.2 \#1.

\begin{cor}
	For all prime \(p\), for all \(n \in \Z_+\), there exists a field of cardinality \(p^{n}\). Furthermore, any two finite fields of the same cardinality are isomorphic.
\end{cor}

\section{Simple Extensions}
\label{sec:simple_extensions}

\begin{thm}
	If \(\left| F \right| < \infty\), and \(K / F\) is a finite extension of \(F\), then \(K = F(\alpha )\) for some \(\alpha  \in K\).
\end{thm}

This holds because \(K^{\times }\) is a cyclic group, and so there must exist \(\alpha \) so \(\langle \alpha  \rangle = K^{\times }\), and hence \(K = F(\alpha )\).

\begin{thm}
	If \(F\) is an infinite field, and \(K / F\) is a finite separable extension, then \(K = F(\alpha )\) for some \(\alpha  \in K\).
\end{thm}
Every field extension can be written by appending a sequence of elements, and we can reduce the elements to one by the combination \(\alpha  = \beta + \gamma  \delta \), where \((\beta ,\gamma )\) is the two additional elements, and \(\delta \neq \frac{\beta_i - \beta }{\gamma  - \gamma_j}\). Often we can simply choose \(\delta =1\) if we are lucky.

\end{document}

Abstract Algebra - Introductory/Algebra II/Notes/source/Lecture24 - Finite_Fields_Simple_Extensions.tex


\section{Estimating the Footprints of Conferences}
\label{sec:footprint}

{\em Carbon footprint} is the key metric that we ultimately seek to reduce
and hence also the starting point of our analysis.  We introduce in this
section the methodology we used and tool we built to conduct all of our
analyses, and we describe the first results from our dataset.

\subsection{Methodology for Evaluating Carbon Footprint}
\label{sec:methodo}

We conduct all our analyses through a \python{} script,\footnote{Publicly available at
  \url{https://github.com/YaZko/sigplan-carbon-analysis}} described in more detail in Section~\ref{sec:software}.
%
Throughout, we make the following assumptions:
\begin{itemize}
\item we assume that participant travel accounts for the entire carbon
footprint of a conference;
\item we assume that {all} conference participants travel by plane, in economy
class;
\item we assume that the airports in the conference city and in each
participant's home city are close enough to the actual end points of their
travel for their locations to be assimilated;
\item we assume that all flights are direct;
\item we assume that the geodesic distance is the one taken by planes.
\end{itemize}
Estimating the errors introduced by these assumptions and refining the
analysis to make more realistic assumptions would obviously be very
worthwhile.
%
But, for this first effort, we are mainly aiming to get a
{\em relative} evaluation of different potential strategies for reducing
footprints; for this purpose, we believe these assumptions are good enough.

The distance traveled by each participant is converted to an amount of
emissions expressed in \gaz. To do this conversion, we use a standard model
introduced as part of the \texttt{DEFRA 16} report on Greenhouse gas
\footnote{\url{https://www.gov.uk/government/publications/greenhouse-gas-reporting-conversion-factors-2016}}
\footnote{\url{https://co2calculator.acm.org/methodology.pdf}} conducted by
the British Government.

The model distinguishes three classes of flight, depending on their length
(short, medium, or long haul). Each class is associated with a linear
coefficient relating the distance of travel to the amount of \gaz{}
emitted.

A second linear coefficient, identical for all flights, is the so-called
\emph{radiative forcing index}; this is used to account for the difference
in radiative forcing between the same emissions at ground level compared to
high in the atmosphere.  We use the value $1.891$ for this coefficient, as
suggested by R. Sausen et al.~\cite{Sausen05}

We thus obtain the following piecewise-linear model of emissions for a
flight covering $d$ kms:

\begin{center}
\gazunit \quad=\quad
\begin{tabular}{@{}lll}
$1.891 * 0.14735 * d$ & if $d < 785$ \\
$1.891 * 0.08728 * d$ & if $785 \leq d < 3700$ \\
$1.891 * 0.077610 * d$ & if $3700\leq d  $
\end{tabular}
\end{center}
% \begin{itemize}
% \item $1.8& * 0.14735 * d$ \gazunit if $d < 785$
% \item $1.891 * 0.08728 * d$ \gazunit if $785 \leq d < 3700$
% \item $1.891 * 0.077610 * d$ \gazunit if $3700\leq d  $
% \end{itemize}

%% It should be noted that experiments with other models show significant variance
%% in absolute value, but resilience in relative values.\bcp{Maybe worth
%%   showing some numbers justifying these statements?}\yz{I agree, will
%%   do}\bcp{Assuming that we can get our numbers to agree with CoolEffect's,
%%   we could also mention this!} Once again, refining the
%% model would hence be a valuable work, but using this simple standard and
%% well-established one appears appropriate to draw conclusion in terms of
%% \emph{relative} impact of different measures.

%% This first pass of the script therefore give us an estimation of the footprint
%% of our conferences. We have implemented on top of it several analyses aiming to
%% estimate the correlation some concrete factors upon which conference organizers
%% can act may have with this footprint.
%% The description of these analyses will cover Section~\ref{sec:community} to \ref{sec:speculate}.

\subsection{Conference Footprints}

\begin{table}
  \centering
  \csvreader[%
    head to column names,
    tabular={|l|l|c|c|c|},
    table head=\hline \bfseries Event & \bfseries Location & \bfseries \# Participants & \bfseries Total footprint & \bfseries Average footprint\\\hline,
    late after line=\\,
    table foot = \hline,
  ]{../../output/sigplan/footprint_confs.csv}{}{%
    \conf\ \year & \location & \csvcoliv & \csvcolv & \csvcolvi
  }
  \caption{For each \event: location, number of participants and carbon footprint,
    total and average per participant, in \gazunitbis. }
  \label{table:footprint}
\end{table}

We now turn to the estimation of footprints in our dataset.
Table~\ref{table:footprint} depicts the total and average carbon footprint per participant of
all conferences analyzed. This footprint is estimated in terms of \gazunitbis{}
(metric tons of CO$_2$-equivalent) of emissions.

The main figure of interest is arguably the last column, depicting the
average footprint per participant.  The lowest average per-participant footprint of
our dataset are tied ICFP'12 and ICFP'14 at 0.88\gazunitbis, while the
highest one is ICFP'16 at 1.93\gazunitbis.

\begin{obs}
The average per-participant carbon footprint due to air travel varies across
conferences in our dataset by around a factor of 2.
\label{obs:footprint}
\end{obs}


\documentclass{article}
\usepackage[utf8]{inputenc}

\title{Relationship between logD, logP and p$K_a$}
\author{Dhiman Ray}
\date{\today}

\usepackage{natbib}
\usepackage{graphicx}

\begin{document}

\maketitle

\section{Derivation for monoprotic acid/base}
Ionization of a solute
\begin{equation}
    X + H^+ \rightleftharpoons XH^+
\end{equation}
Partition coefficients
\begin{equation}
    P^0 = \frac{[X]_{octanol}}{[X]_{water}}, \;\;\;\;
    P^1 = \frac{[XH^+]_{octanol}}{[XH^+]_{water}}, \;\;\;\;
    D = \frac{[X]_{octanol} + [XH^+]_{octanol}}{[X]_{water} + [XH^+]_{water}}
\end{equation}
Using this equation we can write
\begin{equation}
    D = \frac{P^0[X]_{water} + P^1[XH^+]_{water}}{[X]_{water} + [XH^+]_{water}}
    \label{eqn:D}
\end{equation}
From Henderson Equation
\begin{equation}
    pH = pK_a + \log \left(\frac{[X]_{water}}{[XH^+]_{water}}\right)
\end{equation}
we can write
\begin{equation}
    [X]_{water} = [XH^+]_{water} \times 10^{pH - pK_a} = [XH^+]_{water} \frac{10^{- pK_a}}{10^{-pH}} = [XH^+]_{water} \frac{K_a}{[H]}
\end{equation}
Substituting in Eq. \ref{eqn:D}
\begin{equation}
    D = \frac{P^0 [XH^+]_{water} \frac{K_a}{[H]} + P^1[XH^+]_{water}}{[XH^+]_{water} \frac{K_a}{[H]} + [XH^+]_{water}}
\end{equation}
Canceling out the $[XH^+]_{water}$ and rearranging
\begin{equation}
    D = \frac{P^0 K_a + P^1 [H]}{K_a + [H]}
    \label{eqn:Dexact}
\end{equation}
This is the equation which accurately represents the relation between logD, log$P^0$, log$P^1$ and $pK_a$, if we use the relation $K_a = 10^{- pK_a}$ and $[H] = 10^{- pH}$

\section{Approximation}
If we assume that the charged species never goes into octanol phase we can derive simple approximate relations between logP and logD.
\subsection{Weak Acid}
For weak acids $X$ is ionized and $XH^+$ is neutral. So we can consider $P^0 = 0$ and $P = P^1$. So Eq. \ref{eqn:Dexact} becomes
\begin{equation}
    D = \frac{P^1 [H]}{K_a + [H]}
\end{equation}
Rearranging
\begin{equation}
    \frac{D}{P} = \frac{1}{1+\frac{K_a}{[H]}} \;\;\; => \;\;\; \log D = \log P - \log(1+10^{pH-pK_a})
\end{equation}
\subsection{Weak Base}
For weak base $XH^+$ is ionized and $X$ is neutral. So we can consider $P^1 = 0$ and $P = P^0$. So Eq. \ref{eqn:Dexact} becomes
\begin{equation}
    D = \frac{P^0 K_a}{K_a + [H]}
\end{equation}
Rearranging
\begin{equation}
    \frac{D}{P} = \frac{1}{1+\frac{[H]}{K_a}} \;\;\; => \;\;\; \log D = \log P - \log(1+10^{pK_a-pH})
\end{equation}
\subsection{Limitations of the approximation}
This approximation will break down at high pH for weak acids and at low pH for weak base. In that situation a large fraction of the base/acid will be in ionized form. Although the partition coefficient for ionic species is low, some ions will still enter the octanol phase. In that case this approximation will break down and we need to use the Eq. \ref{eqn:Dexact} to calculate logD.
%\bibliographystyle{plain}
%\bibliography{references}
\end{document}


\documentclass[11pt, oneside]{article}

\usepackage{../shared/preamble}
\addbibresource{../shared/references.bib}

\usepackage{proofs}

\title{Proofs}
\author{Arthur Ryman, {\tt arthur.ryman@gmail.com}}
\date{\today}

\begin{document}

\maketitle

\begin{abstract}
This article is a Z Notation specification for proofs and proof checking.
It has been type checked by \fuzz.
The definitions that appear here are taken from Lemmon's book, {\it Beginning Logic}.
The purpose of this specification is to guide the development of a proof checker
aimed at Z specifications
\end{abstract}

\section{Introduction}

For a long time I have thought that it would be extremely useful to be able to write formal proofs
concerning the mathematical objects defined in Z specifications.
There are some very mature proof assistants available.
I know something about Coq, but unfortunately it's style of proof is very different from that one finds in mathematical
papers.

A Coq proof consists of applications of so-called {\it tactics}.
Each tactic represents a higher level aggregate of deductions.
This makes sense for a proof assistant since its job is to help the user discover proofs.
Tactics are like macros and as such they alleviate the user from much low-level tedium.
However, the analog of a macro in normal mathematical writing is a lemma.
Perhaps tactics are more useful for proving formal properties of programming languages where the mathematical
objects of interest are complex, but finite, recursive structures.

While a proof assistant might make sense is some contexts, proper development of a mathematical paper
consists of a gradual introduction of concepts and lemmas leading to the main results.
The proofs should, in some sense, write themselves.
The focus of a mathematical paper should be on explanation and clarity.
The proofs should be easy to read.
I'd therefore really like something that would let me write and check natural looking proofs.

In contrast to Coq, the style of proof presented by Lemmon is very clear and explicit.
However, the task of checking such a proof could easily be delegated to a program,
much the same way that \fuzz\ type checks Z.
In fact Lemmon makes that point that, although there is no mechanical way to discover proofs,
they can be mechanically checked.

I believe that the kernel of a proof checker could be very small.
It is basically an engine driven by a set of deduction rules.
The engine simply needs to check that each deduction rule gets applied correctly.
Even if it turns out that writing such an engine is too much work, the exercise of developing
at least a simple version should give me a greater appreciation of tools like Coq and enable me to
use them more productively.

My plan of attack is to formalize the concept of proof as described by Lemmon, starting with
the propositional calculus, and then move on to predicate calculus.

\section{Propositions}

The {\it propositional calculus} defines a set of formal {\it statements} or {\it propositions}
without being concerned about the subject matter described by those statements.
The only restriction on these statements is that, in any given context,
they possess a {\it truth value} of either {\it true} or {\it false}.

A proposition is also referred to as a {\it well-formed formula} or {\it wff} for short.
This terminology stems from the traditional development of the propositional calculus in terms of
a language of sentences over an alphabet with rules that prescribe when a given sentence is {\it well-formed}.
However, here we will dispense with the language viewpoint, and its associated parsing issues, and move directly
to the end result of parsing, namely the creation of {\it abstract syntax trees} or {\it ASTs} for short.
This approach corresponds to Lemmon's Chapter 1.
He returns to the issue of formal languages in Chapter 2.

\subsection{$Prop$}

Z notation has a convenient mechanism for specifying the structure of ASTs, namely that of {\it free types}.
My first impulse was to use that mechanism to define propositions.
However, the problem with free types is that they are {it closed} in the sense that all ways of constructing members of a free type
must be specified when the free type is defined.
Lemmon's book gradually introduces ways of constructing propositions, so in the interest of following his development of the subject
as closely as possible, I won't define propositions that way.

On closer examination of free types in Z, it will be observed that they are merely syntactic sugar for introducing a new given set
along with an exhaustive set of constructors for its elements.
The constraint expressing the condition that the constructors are exhaustive is equivalent to saying that the domains of the constructors
partition the set of propositions.

Therefore, given any subset of constructors, one can define the corresponding set of propositions that can be constructed from them.
This allows new constructors to be gradually introduced.
I'll take that approach.

Let $Prop$ denote the set of all propositions.

\begin{zed}
	[Prop]
\end{zed}

\subsection{$PropVar$}

Separating of the form of a statement from its content with respect to any given subject matter is accomplished by
the use of {\it propositional variables}.
A propositional variable stands for an arbitrary statement that is either true or false.
Let $PropVar$ denote the set of all propositional variables.

\begin{axdef}
	PropVar: \power Prop
\end{axdef}

\subsection{\zcmd{propP}, \zcmd{propQ}, \zcmd{propR}, \zcmd{propS}, and \zcmd{propT}}

Traditionally, arbitrary statements are represented by single letters such as
$\propP$, $\propQ$, $\propR$, $\propS$, and $\propT$ which represent distinct propositions.

\begin{axdef}
	\propP, \propQ, \propR, \propS, \propT: PropVar
\where
	\disjoint \langle \{\propP\}, \{\propQ\}, \{\propR\}, \{\propS\}, \{\propT\} \rangle
\end{axdef}

\subsection{$PropLetter$}

Let $PropLetter$ denote the set of all proposition letters.

\begin{zed}
	PropLetter == \{ \propP, \propQ, \propR, \propS, \propT \}
\end{zed}

\subsection{\zcmd{propPrime}}

Typical propositions contain a small number of distinct statements, in which case the letters can be used.
If more statements occur then the letters are decorated with one or more primes,
e.g. $\propP \propPrime$, $\propQ \propPrime \propPrime$.
Appending a prime to a propositional variable is an injection from $PropVar$ to $PropVar$.

\begin{axdef}
	\_ \propPrime: PropVar \inj PropVar
\end{axdef}

\begin{example}
$\propP \propPrime$ and $\propQ \propPrime \propPrime$ are propositional variables.
\begin{zed}
	\propP \propPrime \in PropVar
\also
	\propQ \propPrime \propPrime \in PropVar
\end{zed}

\end{example}

A propositional variable is either a letter or is primed.

\begin{zed}
	\langle PropLetter, \ran (\_ \propPrime) \rangle \partition PropVar
\end{zed}

\subsection{\zcmd{notProp} and $Negation$}

Let $A$ be a proposition.
Let $\notProp A$ denote the {\it negation} of $A$.

\begin{axdef}
	\notProp: Prop \inj Prop
\end{axdef}

\begin{example}
$\notProp \propP$ is a negation.

\begin{zed}
	\notProp \propP \in Prop
\end{zed}

\end{example}

Let $Negation$ denote the set of all negations.

\begin{zed}
	Negation == \ran \notProp
\end{zed}

\subsection{\zcmd{andProp} and $Conjunction$}

Let $A$ and $B$ be propositions.
Let $A \andProp B$ denote the {\it conjunction} of $A$ and $B$.
The conjunction $A \andProp B$ is said to have $A$ and $B$ as its {\it conjuncts}.

\begin{axdef}
	\_ \andProp \_: Prop \cross Prop \inj Prop
\end{axdef}

Let $Conjunction$ denote the set of all conjunctions.

\begin{zed}
	Conjunction == \ran (\_ \andProp \_)
\end{zed}

\subsection{\zcmd{orProp} and $Disjunction$}

Let $A$ and $B$ be propositions.
Let $A \orProp B$ denote the {\it disjunction} of $A$ and $B$.
The disjunction $A \orProp B$ is said to have $A$ and $B$ as its {\it disjuncts}.

\begin{axdef}
	\_ \orProp \_: Prop \cross Prop \inj Prop
\end{axdef}

Let $Disjunction$ denote the set of all disjunctions.

\begin{zed}
	Disjunction == \ran (\_ \orProp \_)
\end{zed}

\subsection{\zcmd{impliesProp} and $Conditional$}

Let $A$ and $B$ be propositions.
Let $A \impliesProp B$ denote the {\it conditional} of $A$ and $B$.
The conditional $A \impliesProp B$ is said to have $A$ as its  {\it antecedent} and $B$ as its {\it consequent}.

\begin{axdef}
	\_ \impliesProp \_: Prop \cross Prop \inj Prop
\end{axdef}

Let $Conditional$ denote the set of all conditionals.

\begin{zed}
	Conditional == \ran (\_ \impliesProp \_)
\end{zed}

\subsection{\zcmd{equivProp} and $Biconditional$}

Let $A$ and $B$ be propositions.
Let $A \equivProp B$ denote the {\it biconditional} of $A$ and $B$.

\begin{axdef}
	\_ \equivProp \_: Prop \cross Prop \inj Prop
\where
	\forall A, B: Prop @ \\
	\t1	A \equivProp B = (A \impliesProp B) \andProp (B \impliesProp A)
\end{axdef}

Let $Biconditional$ denote the set of all biconditionals.

\begin{zed}
	Biconditional == \ran (\_ \equivProp \_)
\end{zed}

\section{Proofs}

Lemmon has a nice way of presenting proofs.
Here's an example.

\vspace{1ex}

$\mathbf{1}\ \propP \impliesProp \propQ, \propP \vdash \propQ$

\vspace{1ex}

\begin{tabular}{l l r l l}
&	1	&	(1)	&	$\propP \impliesProp \propQ$	&	$\ruleA$ \\
&	2	&	(2)	&	$\propP$					&	$\ruleA$ \\
&	1,2	&	(3)	&	$\propQ$					&	1,2 $\ruleMPP$
\end{tabular}

\vspace{1ex}

A proof consists of a {\it sequent} to be proved and a finite sequence of one or more {\it lines}.
The lines are labelled by consecutive natural numbers, starting at $1$.

The sequent contains a, possible empty, sequence of assumptions followed by a conclusion.
The sequence of lines that follow show how the conclusion is derived from the assumptions using
various rules of derivation.

Each line of the argument contains an inference.

Each line contains a proposition and the application of the {\it proof rule} used to add it to the proof.
A proof rule is either an {\it assumption} or a {\it derivation}.
The {\it rule of assumption} allows the addition of any proposition.
The {\it rules of derivation} allow the addition of a {\it conclusion} derived from {\it premises} that have been
previously added.
A premise is therefore either an assumption or the conclusion of a previous deduction.
Every line of the proof can therefore be traced back to a finite, possibly empty, set of assumptions upon
which it ultimately {\it depends}.

\subsection{$Sequent$ and \zcmd{sequent}}

A {\it sequent} consists of a sequence of assumptions and a conclusion.
Let $Sequent$ denote the set of all sequents.

\begin{schema}{Sequent}
	assumptions: \seq Prop \\
	conclusion: Prop
\end{schema}

Let $\sequent$ denote the binary operator that takes assumptions and a conclusion and forms a sequent.

\begin{axdef}
	\_ \sequent \_: \seq Prop \cross Prop \fun Sequent
\where
	\forall Sequent @ \\
	\t1	assumptions \sequent conclusion = \theta Sequent
\end{axdef}

\subsection{$RuleOfDerivation$}

Let $RuleOfDerivation$ denote the set of applications of rules of derviation.
In the preceeding example, $\ruleA$ and $\ruleMPP$ are names of rules of derivation.

\begin{zed}
	[RuleOfDerivation]
\end{zed}

\subsection{$Deduction$}

A {\it deduction} consists of a proposition, an application of a rule of derivation that justifies the proposition,
and a finite, possibly empty, set of assumptions on which the proposition depends.
Let $Deduction$ denote the set of all deduction.

\begin{schema}{Deduction}
	assumptions: \finset \nat_1 \\
	prop: Prop \\
	rule: RuleOfDerivation
\end{schema}

\subsection{$DeductionTuple$}

Let $DeductionTuple$ denote the tuple formed by the components of a deduction.

\begin{zed}
	DeductionTuple == \finset \nat_1 \cross Prop \cross RuleOfDerivation
\end{zed}

\subsection{\zcmd{deductionTuple}}

Let $\deductionTuple$ denote the function that maps a deduction to its tuple.

\begin{zed}
	\deductionTuple == (\lambda Deduction @ (assumptions, prop, rule))
\end{zed}

\begin{remark}
The mapping from deductions to tuples is a bijection.

\begin{zed}
	\deductionTuple \in Deduction \bij DeductionTuple
\end{zed}

\end{remark}

\subsection{\zcmd{deductionProp}}

Let $\deductionProp$ denote the function that maps a deduction tuple to its $prop$ component.

\begin{zed}
	\deductionProp == \{~ Deduction @ (assumptions, prop, rule) \mapsto prop ~\}
\end{zed}

\subsection{$Argument$}

An {\it argument} is a finite sequence of deductions.
Let $Argument$ denote the set of all arguments.

\begin{zed}
	Argument == \seq DeductionTuple
\end{zed}

\subsection{$ArgumentDeduction$}

When determining the soundness of an argument, we need to check of the soundness of each deduction.
Each deduction within an argument is uniquely identified by its line number.
Let $ArgumentDeduction$ denote the set of all arguments and valid line numbers in them.

\begin{schema}{ArgumentDeduction}
	argument: Argument \\
	lineNumber: \nat_1 \\
	Deduction
\where
	lineNumber \in \dom argument
\also
	argument(lineNumber) = (assumptions, prop, rule)
\end{schema}
\begin{itemize}
	\item The deduction is identified by its line number within the argument.
	\item The deduction has a tuple of components.
\end{itemize}

\subsection{$SoundDeduction$}

A deduction within an argument is sound if it adheres to one of the rules of derivation.
The rules of derivation will be described below.
Let $SoundDeduction$ denote the set of all sound deductions.

\begin{axdef}
	SoundDeduction: \power ArgumentDeduction
\end{axdef}

\subsection{$SoundArgument$}

An argument is sound precisely when all of its deductions are sound.
Let $SoundArgument$ denote the set of all sound arguments.

\begin{axdef}
	SoundArgument: \power Argument
\end{axdef}

\subsection{\zcmd{deductionSequent}}

Every deduction in an argument defines a sequent.
Let $\deductionSequent$ denote the mapping from deductions to sequents.

\begin{axdef}
	\deductionSequent: ArgumentDeduction \fun Sequent
\where
	\forall ArgumentDeduction @ \\
	\t1	\deductionSequent(\theta ArgumentDeduction) = \\
	\t2		assumptions \extract (argument \comp \deductionProp) \sequent prop
\end{axdef}

\subsection{$ArgumentProvesSequent$}

A sound argument proves a sequent if the final deduction of the argument defines the given sequent.
Let $ArgumentProvesSequent$ denote this situation.

\begin{schema}{ArgumentProvesSequent}
	ArgumentDeduction \\
	s: Sequent
\where
	argument \in SoundArgument
\also
	lineNumber = \# argument
\also
	s = \deductionSequent(\theta ArgumentDeduction)
\end{schema}

\subsection{$Proof$}

A proof is a sequent and a sound argument whose last deduction proves the sequent.
Let $Proof$ denote the set of proofs.

\begin{axdef}
	Proof: Sequent \rel SoundArgument
\where
	Proof = \{~ ArgumentDeduction | \\
	\t1	(lineNumber = \# argument \land \\
	\t1	argument \in SoundArgument) @ \\
	\t2		\deductionSequent(\theta ArgumentDeduction) \mapsto argument ~\}
\end{axdef}

\subsection{\zcmd{ruleA}}

Let $\ruleA$ denote the rule of assumption.
The rule of assumption is used to introduce an arbitrary assumption at any point in the argument.

\begin{axdef}
	\ruleA: RuleOfDerivation
\end{axdef}

\subsection{$RuleOfAssumptionDetail$}

A deduction uses the rule of assumption $\ruleA$ in an argument is sound if it introduces some arbitrary proposition $P$ and
it depends only on itself.
Let $RuleOfAssumptionDetail$ denote the set of all deductions, along with their details, that use the rule of assumption soundly.

\begin{schema}{RuleOfAssumptionDetail}
	ArgumentDeduction \\
	P: Prop
\where
	assumptions = \{ lineNumber \}
\also
	prop = P
\also
	rule = \ruleA
\end{schema}

\begin{itemize}
	\item The deduction depends only on itself.
	\item The deduction introduces an arbitrary proposition $P$.
	\item The deduction is justified by the rule of assumption $\ruleA$.
\end{itemize}

\subsection{$RuleOfAssumption$}

Let $RuleOfAssumption$ denote the set of all deductions that use the rule of assumption with the detail hidden.

\begin{zed}
	RuleOfAssumption \defs RuleOfAssumptionDetail \project ArgumentDeduction
\end{zed}

The rule of assumption is sound.

\begin{zed}
	RuleOfAssumption \subset SoundDeduction
\end{zed}

\subsection{\zcmd{ruleMPP}}

Let $\ruleMPP$ denote the MPP rule.
The MPP rule is used to deduce the consequent of a conditional given its antecedent.
The rule specifies the conditional and antecedent as its premises.

\begin{axdef}
	\ruleMPP: \nat_1 \cross \nat_1 \fun RuleOfDerivation
\end{axdef}

\subsection{$RuleOfMPPDetail$}

A deduction that uses the rule $\ruleMPP(i, j)$ in an argument is sound if $i$ and $j$ are lines
that precede it, the proposition on line $i$ is an implication, the proposition on line $j$ is the antecedent
of the implication, the proposition of the proof line is the consequent of the implication,
and the proof line's assumptions is the union of the assumptions of lines $i$ and $j$.
Let $RuleOfMPPDetail$ denote the set of all deductions, along with their detail, that use the rule of MPP soundly.

\begin{schema}{RuleOfMPPDetail}
	ArgumentDeduction \\
	i, j: \nat_1 \\
	Deduction_1 \\
	Deduction_2 \\
	P, Q: Prop
\where
	rule =  \ruleMPP(i, j)
\also
	i < lineNumber \land j < lineNumber
\also
	argument(i) = (assumptions_1, P \impliesProp Q, rule_1)
\also
	argument(j) = (assumptions_2, P, rule_2)
\also
	assumptions = assumptions_1 \cup assumptions_2
\also
	prop = Q
\end{schema}

\begin{itemize}
	\item The rule of derivation is $\ruleMPP$ which specifies the premise line numbers $i$ of a conditional and $j$ of its antecedent.
	\item The line numbers of the conditional and its antecedent must precede the deduction in the argument.
	\item Line number $i$ contains a conditional of the form $P \impliesProp Q$.
	\item Line number $j$ contains the antecedent $P$ of the conditional.
	\item The deduction depends on the union of the assumptions that the premises depend on.
	\item The deduction introduces the consequent $Q$ as the conclusion of the premises.
\end{itemize}

\subsection{$RuleOfMPP$}

Let $RuleOfMPP$ denote the set of all deductions that use the rule of MPP with the detail hidden.

\begin{zed}
	RuleOfMPP \defs RuleOfMPPDetail \project ArgumentDeduction
\end{zed}

The rule of MPP is sound.

\begin{zed}
	RuleOfMPP \subset SoundDeduction
\end{zed}

\subsection{$argument_1$}

Let $argument_1$ denote the argument defined by proof $\mathbf{1}$.

\begin{zed}
	argument_1 == \\
	\t1	\{ 1 \mapsto (\{ 1\}, \propP \impliesProp \propQ, \ruleA), \\
	\t1	2 \mapsto (\{ 2 \}, \propP, \ruleA), \\
	\t1	3 \mapsto (\{ 1, 2 \}, \propQ, \ruleMPP(1,2)) \}
\end{zed}

\begin{example}
$argument_1$ is an argument.

\begin{zed}
	argument_1 \in Argument
\end{zed}

\end{example}

\begin{example}
Line 3 of proof $\mathbf{1}$ corresponds to the following deduction tuple.

\begin{zed}
	(\{ 1, 2 \}, \propQ, \ruleMPP(1,2)) \in DeductionTuple
\end{zed}

\end{example}

\subsection{$proof_2$}

Here is Lemmon's proof $\mathbf{2}$.

\vspace{1ex}

$\mathbf{2}\ \notProp \propQ \impliesProp (\notProp \propP \impliesProp \propQ), \notProp \propQ \vdash \notProp \propP \impliesProp \propQ$

\vspace{1ex}

\begin{tabular}{l l r l l}
&	1	&	(1)	&	$\notProp \propQ \impliesProp (\notProp \propP \impliesProp \propQ)$	&	$\ruleA$ \\
&	2	&	(2)	&	$\notProp \propQ$											&	$\ruleA$ \\
&	1,2	&	(3)	&	$ \notProp \propP \impliesProp \propQ$							&	1,2 $\ruleMPP$
\end{tabular}

\vspace{1ex}

Let $sequent_2$ denote the sequent of this proof.

\begin{zed}
	sequent_2 == \langle \notProp \propQ \impliesProp (\notProp \propP \impliesProp \propQ),  \notProp \propQ \rangle \sequent \notProp \propP \impliesProp \propQ
\end{zed}

Let $argument_2$ denote the argument of this proof.

\begin{zed}
	argument_2 == \\
	\t1	\{ 1 \mapsto (\{ 1\}, \notProp \propQ \impliesProp (\notProp \propP \impliesProp \propQ), \ruleA), \\
	\t1	2 \mapsto (\{ 2 \}, \notProp \propQ, \ruleA), \\
	\t1	3 \mapsto (\{ 1, 2 \}, \notProp \propP \impliesProp \propQ, \ruleMPP(1,2)) \}
\end{zed}

Let $proof_2$ denote this proof.

\begin{zed}
	proof_2 ==  (sequent_2, argument_2)
\end{zed}

\begin{example}
$proof_2$ is a proof.

\begin{zed}
	proof_2 \in Proof
\end{zed}

\end{example}

\section{The Curry-Howard Correspondence}

The {\it Curry-Howard Correspondence} is an interpretation of propositions and proofs in terms of types.
To each proposition there correspondences a type.
The inhabitants of the type that corresponds to a proposition are proofs of that proposition.
The logical connectives that build up propositions correspond to type constructors.

To illustrate the correspondence, consider the implication logical connective $P \implies Q$.
It corresponds to the type constructor $P \fun Q$.
A proof $f$ of $P \implies Q$ corresponds to a function that maps any proof of $P$ to some proof of $Q$.

Of course, $P \fun Q$ is not a type in Z.
It is a subset of the type $\power(P \cross Q)$.
Nevertheless, we'll press on and pretend that it is a Z type for now.

The rules of derivation correspond to the construction of a proof from assumptions.
For example the rule of MPP corresponds to function application.
Consider $Proof_1$.
It corresponds to the following.

\begin{schema}{CHProof1}[P,Q]
	f: P \fun Q \\
	x: P \\
	y: Q
\where
	y = f(x)
\end{schema}

\printbibliography

\end{document}


\subsubsection{Forward Bond}
\label{ss:forwardbond}

A Forward Bond (or Bond Forward) is a contract that establishes an agreement to buy or sell (determined by
\lstinline!LongInForward!) an underlying bond at a future point in time (the {\tt ForwardMaturityDate}) at an agreed
price (the settlement {\tt Amount}).

A T-Lock is a Forward Bond with a US Treasury Bond as underlying, whereas a J-Lock is a Forward Bond with a Japanese
Government Bond as underlying. T-Locks can be specified in terms of a lock-in yield rather then a settlement
amount. The cash settlement amount is given by (bond yield at maturity - lock rate) x DV01 in this case.

Listing \ref{lst:forward_bond} shows an example for a physically settled forward bond. Listing
\ref{lst:forward_bond_tlock} shows an example for a cash settled T-Lock transaction specified by a lock-in yield.

A Forward Bond is set up using a {\tt ForwardBondData} block as shown below and the trade type is
\emph{ForwardBond}. The specific elements are

\begin{itemize}
   \item BondData: A {\tt BondData} block specifying the underlying bond as described in section~\ref{ss:bond}. A long
     position must be taken in the bond, i.e.~({\tt Payer}) flag must be set to ({\tt true}). The bond data block
     contains an additional field for forward bonds
     \begin{itemize}
     \item IncomeCurveId: The benchmark curve to be used for compounding, this must match a name of a curve in the yield
       curves or index curve block in {\tt todaysmarket.xml}. It is optional to provide this curve. If left out the
       market reference yield curve from {\tt todaysmarket.xml} is used for compounding.
     \end{itemize}
   \item SettlementData: The entity defining the terms of settlement:
   \begin{itemize}
       \item ForwardMaturityDate: The date of maturity of the forward contract. \\
         Allowable values: See \lstinline!Date! in Table \ref{tab:allow_stand_data}.
       \item Settlement [Optional]: Cash or Physical. Option, defaults to Physcial, except in case the settlement is
         defined by LockRate, in which case it defaults to Cash. \\
         Allowable values: Cash, Physical
       \item Amount [Optional]: The settlement amount (also called strike) transferred at forward maturity in return for
         the bond (physical delivery) or a cash amount equal to the dirty price of the bond (cash settlement). This is
         transferred from the party that is long to the party that is short (determined by \lstinline!LongInForward!)
         and cannot be a negative amount. It is assumed to be in the same currency as the underlying bond. Exactly one
         of the fields Amount, LockRate must be given. \\
         Allowable values: Any non-negative real number.
       \item LockRate [Optional]: The payoff is given by (yield at forward maturity - LockRate) x DV01 (LongInForward =
         true). Exactly one of the fields Amount, LockRate must be given. In case the LockRate is given, the Settlement
         must be set to Cash. If Settlement is not given, it defaults to Cash in this case. \\
         Allowable values: Any non-negative real number.
       \item LockRateDayCounter [Optional]: The day counter w.r.t. which the lock rate is expressed. Optional, defaults to A360. \\
         Allowable values: see table \ref{tab:daycount}
       \item SettlementDirty [Optional]: A flag that determines whether the settlement amount {({\tt Amount})} reflects
         a clean (\emph{false}) or dirty (\emph{true}) price. In either case, the dirty amount is actually paid on the
         forward maturity date, i.e. if SettlementDirty = \emph{false}, the (forward) accruals are computed internally
         and added to the given amount to get the actual settlement amount. Optional, defaults to true. \\
         Allowable values: \emph{true}, \emph{false}
   \end{itemize}
   \item PremiumData: The entity defining the terms of a potential premium payment. This node is optional. If left out it is assumed that no premium is paid.
   \begin{itemize}
       \item Date: The date when a premium is paid. \\
       Allowable values: See \lstinline!Date! in Table \ref{tab:allow_stand_data}.
       \item Amount: The amount transferred as a premium. This is transferred from the party that is long to the party
         that is short (determined by \lstinline!LongInForward!) and cannot be a negative amount. It is assumed to be in
         the same currency as the underlying bond.\\
       Allowable values: Any non-negative real number.
   \end{itemize}
   \item LongInForward: A flag that determines whether the forward contract is entered in long (\emph{true}) or short
     (\emph{false}) position. \\
       Allowable values: \emph{true}, \emph{false}
 \end{itemize}

\begin{listing}[H]
  \begin{minted}[fontsize=\small]{xml}
   <ForwardBondData>
     <BondData>
      ...
      <IncomeCurveId>BENCHMARKINCOME-EUR<IncomeCurveId>
     </BondData>
     <SettlementData>
       <ForwardMaturityDate>20160808</ForwardMaturityDate>
       <Settlement>Physcial</Settlement>
       <ForwardSettlementDate>20160810</ForwardSettlementDate>
       <Amount>1000000.00</Amount>
       <SettlementDirty>true</SettlementDirty>
     </SettlementData>
     <PremiumData>
       <Amount>1000.00</Amount>
       <Date>20160808</Date>
     </PremiumData>
     <LongInForward>true</LongInForward>
   </ForwardBondData>
  \end{minted}
\caption{Forward Bond Data}
\label{lst:forward_bond}
\end{listing}

\begin{listing}[H]
   \begin{minted}[fontsize=\small]{xml}
   <ForwardBondData>
     <BondData>
      ...
     </BondData>
     <SettlementData>
       <ForwardMaturityDate>20160808</ForwardMaturityDate>
       <ForwardSettlementDate>20160810</ForwardSettlementDate>
       <LockRate>0.02365</LockRate>
     </SettlementData>
     <LongInForward>true</LongInForward>
   </ForwardBondData>
\end{minted}
\caption{Forward Bond Date (T-Lock)}
\label{lst:forward_bond_tlock}
\end{listing}

As for the ordinary bond the forward bond pricing requires a recovery rate that can be specified in ORE per SecurityId.

\subsubsection*{Forward Bond - Pricing Engine configuration}

The configuration for the pricing engine of the forward bond is identical to the ordinary bond.%, cf.~Section~\ref{BondEngineConfig}.
The pricing engine called by forward bond products is the {\tt DiscountingForwardBondEngine}, see below for a configuration example.

%\hrule\medskip
   \begin{minted}[fontsize=\small]{xml}
   <Product type="ForwardBond">
   <Model>DiscountedCashflows</Model>
   <ModelParameters></ModelParameters>
   <Engine>DiscountingForwardBondEngine</Engine>
   <EngineParameters>
    <Parameter name="TimestepPeriod">3M</Parameter>
   </EngineParameters>
   </Product>
   \end{minted}
%\caption{Bond Data}