\documentclass[12pt, answers]{exam}
%\documentclass[12pt]{exam}
\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage{setspace}
\PassOptionsToPackage{hyphens}{url}
\usepackage{tabu}
\onehalfspacing
\setlength{\parindent}{0mm} \setlength{\parskip}{1em}

% packages
\RequirePackage{amssymb, amsfonts, amsmath, latexsym, verbatim, xspace, setspace}
\RequirePackage{tikz}
% The float package HAS to load before hyperref
\usepackage{float} % for psuedocode formatting
\usepackage{amsthm}
\usepackage{epsfig}
\usepackage{times}
\renewcommand{\ttdefault}{cmtt}
\usepackage{amsmath}
\usepackage{graphicx} % for graphics files

% for creating indented blocks
\usepackage{scrextend}
\usepackage{paralist, tabularx}

% from Denovo Methods Manual
\usepackage{mathrsfs}
\usepackage[mathcal]{euscript}
\usepackage{color}
\usepackage{array}

\usepackage[pdftex]{hyperref}
\usepackage[parfill]{parskip}
\usepackage{cancel}

\newcommand{\nth}{n\ensuremath{^{\text{th}}} }
\newcommand{\ve}[1]{\ensuremath{\mathbf{#1}}}
\newcommand{\Macro}{\ensuremath{\Sigma}}
\newcommand{\vOmega}{\ensuremath{\hat{\Omega}}}
\newcommand{\cc}[1]{\ensuremath{\overline{#1}}}
\newcommand{\ccm}[1]{\ensuremath{\overline{\mathbf{#1}}}}

%--------------------------------------------------------------------
%--------------------------------------------------------------------
\begin{document}
\begin{center}
{\bf NE 155, Topic 14, S21 \\
Finite Difference and Volume Methods for the Eigenvalue form of the DE \\ April 1, 2021}
\end{center}

\setlength{\unitlength}{1in}
\begin{picture}(6,.1)
\put(0,0) {\line(1,0){6.25}}
\end{picture}

%------------------------------------------
\subsection*{Helmholtz Form}
When we derived the Diffusion Equation, we skipped over the Helmholtz form. I am bringing it up now b/c it can be a convenient way to solve the DE. This approach can also be useful if you need to generate an analytical solution.

In steady state, we can write the diffusion equation this way:
%
\begin{align*}
-\nabla \cdot D(\vec{r})\nabla \phi(\vec{r}) +
\Sigma_a \phi(\vec{r}) &= Q(\vec{r})\:, \\
%
\text{where }\qquad Q(\vec{r}) &=
\nu \Sigma_f \phi(\vec{r}) +
S(\vec{r})\:,
\end{align*}
%
which can be written as the Helmholtz equation of applied mathematics:
%http://en.wikipedia.org/wiki/Helmholtz_equation
%
\ifprintanswers
\begin{align*}
\nabla^2 \phi(\vec{r}) - \frac{1}{L^2}\phi(\vec{r}) &= \frac{-Q(\vec{r})}{D}\:, \\
\text{where }\qquad L &\equiv \sqrt{\frac{D}{\Sigma_a}}\:.
\end{align*}
\else
\\ \vspace*{4em}\\
\fi
%
$L$ is called the neutron diffusion length. This is ``how far a neutron diffuses from a source prior to absorption".

In the Helmholtz formulation, $\phi$ is amplitude and $\frac{1}{L}$ is wave number.

This formulation is useful because we know how to solve it. We write
\[\phi(\vec{r}) = \phi_H(\vec{r}) + \phi_P(\vec{r}) \:,\]

For example, we often have:
\[\phi_H(\vec{r}) = A\exp\bigl(-\frac{|\vec{r}|}{L}\bigr) + B\exp\bigl(\frac{|\vec{r}|}{L}\bigr) \:.\]

Going through how to solve this analytically in a variety of circumstances, geometries, etc.\ is another class (NE 150/250).

%------------------------------------------
\subsection*{Criticality Calculations}
\textbf{Recall:}

We also want to think about the details of how to configure a reactor to get it to work the way we want it to.
We can write our DE in steady state for a nuclear reactor core:
%
\begin{align*}
-\nabla \cdot D\nabla \phi(\vec{r}) +
\Sigma_a \phi(\vec{r}) &= \nu \Sigma_f \phi(\vec{r})\:, \\
\text{with} \qquad \phi(\tilde{x}_s) &= 0\:.
\end{align*}
%
Unless we have the proper combination of core composition ($\Sigma_a$, $\Sigma_f$, $D$) and geometry ($\vec{r}$ ,$\vec{r}_s$) details, there is \underline{no} general solution.

To deal with this, we introduce a parameter $k$ into the equation:
%
\begin{equation}
-\nabla \cdot D\nabla \phi(\vec{r}) +
\Sigma_a \phi(\vec{r}) = \frac{1}{k}\nu \Sigma_f \phi(\vec{r})\:. \nonumber
\end{equation}
%
Then, for any value of $k$ we assert that there is always a solution. We use an iterative process to find the condition when $k=1$, called ``critical''.

%A reactor is called \textbf{``critical''} if the chain reaction is self-sustaining and time-independent. Another way to think of the addition of $k$ is to assume $\nu$ can be adjusted to obtain a time-independent solution by replacing it with $\frac{\nu}{k}$, where $k$ is the parameter expressing the deviation from critical.
%
%This substitution changes the transport equation into an \textbf{eigenvalue problem.} A spectrum of eigenvalues can be found, but at \textbf{long times only the non-negative solution corresponding to the largest real eigenvalue will dominate}, and that's $k$.
%
%$k$ can also be thought of as the asymptotic ratio of the number of neutrons in one generation to the number in the next.

%--------------------------------------------------------------------
\section*{Finite Difference Method, Eigenvalue Problem}

We can extend all of the finite difference and finite volume methods we just learned to the eigenvalue problem case, which is another layer of complication.

Now instead of a fixed source, we have an eigenvalue problem
\[-\frac{d}{dx}D(x)\frac{d \phi(x)}{dx} + \Sigma_a(x) \phi(x) = \frac{1}{k}\nu \Sigma_f(x) \phi(x) \]
%
\begin{figure}[h!]
\begin{center}
\includegraphics[height=1in]{FVM-fig}
\end{center}
\end{figure}
%
Let's again have a reflecting condition at the centerline ($x_0 = 0$) and vacuum on the right ($x_n = a$):
\begin{align}
\frac{d}{dx}\phi(x) \big|_{x=0} &= 0 \qquad \text{zero net current,} \nonumber\\
\phi(\tilde{a}) &= 0 \qquad \tilde{a} = a + 2D\:. \nonumber
\end{align}
%
We again have a spatial mesh:
%
\begin{center}
\begin{tikzpicture}
\draw (-.25,0)--(1.25,0);
\draw[dotted] (1.25,0)--(2.75,0);
\draw (2.75,0)--(5.25,0);
\draw[dotted] (5.25,0)--(6.75,0);
\draw (6.75,0)--(8.25,0);
%\draw (4,0)--(5.25,0);
\draw (0,-.25)--(0,.25);
\draw (1,-.25)--(1,.25);
%\draw (2,-.25)--(2,.25);
\draw (3,-.25)--(3,.25);
\draw (4,-.25)--(4,.25);
\draw (5,-.25)--(5,.25);
\draw (7,-.25)--(7,.25);
\draw (8,-.25)--(8,.25);
\node[below] at (0,-.25) {$x_0$};
\node[below] at (1,-.25) {$x_1$};
\node[below] at (3,-.25) {$x_{i-1}$};
\node[below] at (4,-.25) {$x_i$};
\node[below] at (5,-.25) {$x_{i+1}$};
\node[below] at (7,-.25) {$x_{n-1}$};
\node[below] at (8,-.25) {$x_n$};
\node[above] at (0.5, 0.5) {$h_1$};
\node[above] at (3.5, 0.5) {$h_i$};
\end{tikzpicture}
\end{center}
%
and in this configuration $x_0 = 0$, $x_n = a$, and $h_i$ is the mesh spacing. There are $n+1$ points and $n$ mesh cells.

Material discontinuities will coincide with the cell \textit{edges}, $x_i$. Thus, we can assume that the cross sections and the diffusion coefficient are constant in each cell.
%
%\begin{align}
%D(x) &= D_i \qquad \text{for } x_{i-1} \leq x \leq x_i \:,\nonumber \\
%\Sigma_{a}(x) &= \Sigma_{a,i} \qquad \text{for } x_{i-1} \leq x \leq x_i \:, \nonumber \\
%\nu\Sigma_f(x) &= \nu\Sigma_{f,i}\;, \quad \text{for } x_{i-1} \leq x \leq x_i\:, \nonumber \\
%h_i &\equiv x_i - x_{i-1} \:.\nonumber
%\end{align}
%
The unknown values are again defined at the mesh or cell \textit{edges}, e.g.\ $\phi(x_i) = \phi_i$.

We derive the equations just like we did in the fixed source case, but now instead of $S_i$ we have $\nu \Sigma_{f,i}$ on the rhs and a $1/k$ in multiplying the rhs vector.

\ifprintanswers
\begin{align}
\frac{\phi_{i+1} - 2\phi_i + \phi_{i-1}}{h_i^2} - \frac{1}{L_i^2}\phi_i = -\frac{1}{k}\frac{\nu\Sigma_{f,i}}{D_i}\phi_i \qquad i &= 1, 2, \dots, n-1 \:,\nonumber \\
%
-\phi_{i-1} + \bigl(2 + \frac{h_i^2}{L_i^2}\bigr)\phi_i - \phi_{i+1} = \frac{1}{k} h_i^2 \frac{\nu\Sigma_{f,i}}{D_i}\phi_i \qquad i &= 1, 2, \dots, n-1\: \text{ or,} \nonumber\\
%
\nonumber \\
\frac{-D_i}{h_i^2}\phi_{i-1} + \biggl(\frac{2D_i}{h_i^2} + \Sigma_{a,i} \biggr)\phi_i - \frac{D_i}{h_i^2}\phi_{i+1} = \frac{1}{k} \nu\Sigma_{f,i}\phi_i \qquad i &= 1, \dots, n-1 \:.\nonumber
\end{align}
\else
\vspace*{10em}
\fi

With this formulation we still have the problem that our unknown is defined the cell edges and if the properties in neighboring cells differ we will have discontinuities. To be able to handle \textit{material discontinuities} we're going to do our volume integration again.

%-----------------------------------------------------
%-----------------------------------------------------
\section*{Finite Volume Method}

Like last time, we will integrate the flux and source values across neighboring half-cells.
%
\begin{figure}[h!]
\includegraphics[height=2.5in]{FVM-eig-fig}
\end{figure}

We again assume the cross section and diffusion coefficient are constant in each cell; for $i=1, \dots, n$:
\begin{align}
D(x) &= D_i\;, \qquad x_{i-1} \leq x \leq x_i \nonumber \\
\Sigma_a(x) &= \Sigma_{a,i}\;, \qquad x_{i-1} \leq x \leq x_i \nonumber \\
\nu\Sigma_f(x) &= \nu\Sigma_{f,i}\;, \quad x_{i-1} \leq x \leq x_i \nonumber \\
h_i &\equiv x_{i} - x_{i-1} \:.\nonumber
\end{align}
%
We also still assume that the fluxes are constant over the interval centered around $x_i$; for $i=0, \dots, n$:
%
\begin{align}
\phi(x) &= \phi_i \qquad \text{for } \bigl(x_i - \frac{h_i}{2}\bigr) \leq x \leq \bigl(x_i + \frac{h_{i+1}}{2}\bigr)\:. \nonumber %\\
%S(x) &= S_i \qquad \text{for } \bigl(x_i - \frac{h_i}{2}\bigr) \leq x \leq \bigl(x_i + \frac{h_{i+1}}{2}\bigr) \nonumber
\end{align}

Now, we integrate the differential equation over each cell, $\bigl(x_i - \frac{h_i}{2}\bigr) \leq x \leq \bigl(x_i + \frac{h_{i+1}}{2}\bigr)$:
%
\[\int_{(x_i - \frac{h_i}{2})}^{(x_i + \frac{h_{i+1}}{2})} \biggl(  -\frac{d}{dx}D(x)\frac{d \phi(x)}{dx}\biggr) dx
+ \int_{(x_i - \frac{h_i}{2})}^{(x_i + \frac{h_{i+1}}{2})} \Sigma_a(x) \phi(x) dx
= \int_{(x_i - \frac{h_i}{2})}^{(x_i + \frac{h_{i+1}}{2})} \frac{1}{k}\nu \Sigma_f(x) \phi(x) dx\]
%
We'll only add the term we didn't do before:
%
\ifprintanswers
\begin{align}
\int_{(x_i - \frac{h_i}{2})}^{(x_i + \frac{h_{i+1}}{2})} \frac{1}{k}\nu \Sigma_f(x)\phi(x) dx &=
%
\int_{(x_i - \frac{h_i}{2})}^{(x_i)} \frac{1}{k}\nu \Sigma_f(x) \phi(x) dx + \int_{(x_i)}^{(x_i + \frac{h_{i+1}}{2})} \frac{1}{k}\nu \Sigma_f(x) \phi(x) dx \nonumber\\
%
&\nonumber \\
&= \frac{1}{k} \biggl(\frac{\nu\Sigma_{f,i}h_i + \nu\Sigma_{f,i+1}h_{i+1}}{2} \biggr)\phi_i \:.\nonumber
\end{align}
\else
\\ \vspace*{4em}
\fi

Collecting all of the terms:
%
\begin{equation}
-D_{i+1}\biggl(\frac{\phi_{i+1} - \phi_i}{h_{i+1}}\biggr) + D_{i}\biggl(\frac{\phi_{i} - \phi_{i-1}}{h_{i}}\biggr) + \biggl(\frac{\Sigma_{a,i}h_i + \Sigma_{a,i+1}h_{i+1}}{2} \biggr)\phi_i =   \frac{1}{k} \biggl(\frac{\nu\Sigma_{f,i}h_i + \nu\Sigma_{f,i+1}h_{i+1}}{2} \biggr)\phi_i \:.\nonumber
\end{equation}

To express this in matrix form we'll use the same abbreviations as last time, and add one for the fission term (where we've divided through by $h_{ii}$ to get the x-sec terms):
\begin{align}
%h_{ii} &= \frac{h_i + h_{i+1}}{2} \nonumber \\
%%
%\Sigma_{a,ii} &= \frac{\Sigma_{a,i}h_i + \Sigma_{a,i+1}h_{i+1}}{h_i + h_{i+1}} \nonumber \\
\nu\Sigma_{f,ii} &= \frac{\nu\Sigma_{f,i}h_i + \nu\Sigma_{f,i+1}h_{i+1}}{h_i + h_{i+1}} \:.\nonumber
\end{align}
%
Then
%
\[a_{i,i-1} \phi_{i-1} + a_{i,i}\phi_i + a_{i, i+1} \phi_{i+1} = \frac{1}{k}\nu\Sigma_{f,ii} \phi_i \qquad \text{for } i = 1, 2, \dots, n-1\:,\]
%
where the $a$s have the same value as last time. (Only the rhs is new.)
%
%\begin{align}
%a_{i,i-1} &= \frac{-D_i}{h_i h_{ii}}\:, \nonumber \\
%a_{i,i} &= \frac{D_i}{h_i h_{ii}} + \frac{D_{i+1}}{h_{i+1} h_{ii}} +\Sigma_{a,ii}\:, \nonumber \\
%a_{i,i+1} &= \frac{-D_{i+1}}{h_{i+1} h_{ii}}:.\nonumber
%\end{align}

We again have a set of $n-1$ linear algebraic equations with $n+1$ unknowns. We will use the boundary conditions to get the rest of the information that we need.

%-------------------------------------------------------
\subsection*{Boundary Conditions}

Again assume $x_n = \tilde{a}$, then the \textbf{vacuum condition} becomes
\[\phi_n = 0\]
and the last equation for $i=n-1$ becomes
\ifprintanswers
\[a_{n-1,n-2} \phi_{n-2} + a_{n-1,n-1}\phi_{n-1} + 0 = \frac{1}{k}\nu\Sigma_{f,(n-1,n-1)} \phi_{n-1}\]
\else
\\ \vspace*{2em}
\fi

To include the \textbf{reflecting} or zero current condition we integrate over $[0, h_{1}/2]$.
%
\begin{figure}[h!]
\includegraphics[height=2in]{ReflectingBC-eig}
\end{figure}
%
\begin{align}
\int_{0}^{\frac{h_{1}}{2}} \biggl(-\frac{d}{dx}D(x)\frac{d \phi(x)}{dx}\biggr) dx &+ \int_{0}^{\frac{h_{1}}{2}} \Sigma_a(x) \phi(x) dx = \int_{0}^{\frac{h_{1}}{2}} \frac{1}{k}\nu \Sigma_f(x) \phi(x) dx \:. \nonumber %\\
%
%-D(x)\frac{d \phi(x)}{dx}\big|_{\frac{h_{1}}{2}} &+ D(x)\frac{d \phi(x)}{dx}\big|_{0} + \Sigma_{a,1}\phi_0 \frac{h_1}{2} = \frac{1}{k}\nu\Sigma_{f,1} \phi_0 \frac{h_1}{2} \nonumber
\end{align}
%
We perform the integration and can apply the boundary condition $\frac{d \phi(x)}{dx}\big|_{0} = 0$ just like last time,
%\[-D(x)\frac{d \phi(x)}{dx}\big|_{\frac{h_{1}}{2}} + \Sigma_{a,1}\phi_0 \frac{h_1}{2} = \frac{1}{k}\nu\Sigma_{f,1} \phi_0 \frac{h_1}{2}\]
%%
%Recall that
%\[-D(x)\frac{d \phi(x)}{dx}\big|_{\frac{h_{1}}{2}} \cong -D_{1}\biggl(\frac{\phi_{1} - \phi_0}{h_{1}}\biggr) \]
%
and the first equation ($i=0$) becomes
\[a_{00}^*\phi_0 + a_{01}^* \phi_1 = \frac{1}{k}\nu\Sigma_{f,1} \phi_0 \:,\]
%
where we redefine the $a^*$s to be the same as last time as well.%to be (I've added the * to indicate that these have different definitions than the rest of the terms.)
%
%\begin{align}
%a_{00}^* &= \frac{2D_1}{h_1^2} + \Sigma_{a,1} \nonumber \\
%a_{01}^* &= -\frac{2D_1}{h_1^2} \nonumber
%\end{align}

We now have $n$ equations and $n$ unknowns, but we formulate it a bit differently:
\[\ve{A}\vec{\phi} = \frac{1}{k}\ve{F}\vec{\phi}\:,\]
where:
\begin{align}
%\ve{A} &= \begin{pmatrix}
%a_{00}^* & a_{01}^* & 0      & 0 & \cdots & 0 \\
%a_{10}   & a_{11}   & a_{12} & 0 & \cdots & 0 \\
%0        & a_{21}   & a_{22}   & a_{21} &  & \vdots \\
%\vdots        &    & \ddots  & \ddots & \ddots & \vdots \\
%0 & \cdots & 0 & a_{n-3,n-3}   & a_{n-2,n-2} & a_{n-2,n-1} \\
%0        & \cdots   & 0   & 0 & a_{n-1,n-2} & a_{n-1,n-1}
%\end{pmatrix} \nonumber \\
%%
%\vec{\phi} &= \begin{pmatrix}\phi_0 \\ \phi_1 \\ \phi_2 \\ \vdots \\ \phi_{n-2} \\ \phi_{n-1} \end{pmatrix} \:, \qquad
%
\ve{F} = \begin{pmatrix}
\nu\Sigma_{f,1} & 0 & 0 & 0 & \cdots & 0 \\
0   & \nu\Sigma_{f,11} & 0  & 0 & \cdots & 0 \\
0   & 0 & \nu\Sigma_{f,22}  & 0 & \cdots & 0 \\
\vdots  &     & \ddots  & \ddots & \ddots  & \vdots \\
0 & \cdots & 0 & 0 & \nu\Sigma_{f,n-2,n-2} & 0 \\
0        & \cdots & 0 & 0   & 0 & \nu\Sigma_{f,n-1,n-1}
\end{pmatrix} \:.\nonumber
\end{align}

%----------------------------------------------------------------
%----------------------------------------------------------------
\section*{Solution Methods}

We are only going to talk about iterative solution methods for eigenvalue problems since no one uses direct methods in practice (dealing with directly solving an eigenvalue matrix problem rapidly becomes intractable). We will formulate the problem this way, where $m$ is the eigenvalue or ``outer" iteration index:
%
\ifprintanswers
\[ \ve{A} \vec{\phi}^{(m+1)} = \frac{1}{k^{(m)}}\ve{F}\vec{\phi^{(m)}}\]
\else
\\ \vspace*{3em}
\fi

There are a variety of ways you can choose to determine convergence. We will consider these convergence criteria:
\begin{align}
\bigg|\frac{k^{(m)} - k^{(m-1)}}{k^{(m)}}\bigg| &< \epsilon_1 \:, \nonumber \\
\bigg|\frac{\phi_i^{(m)} - \phi_i^{(m-1)}}{\phi_i^{(m)}}\bigg| &< \epsilon_2 \qquad \forall i\:. \nonumber
\end{align}
%
Where $\epsilon_1$ is the eigenvalue convergence criterion (often $1 \times 10^{-4}$ or smaller), and $\epsilon_2$ is the flux error criterion (often $1 \times 10^{-3}$ or smaller).

\subsection*{Finding $k$}

But wait, that iterative method was only telling us how to update $\vec{\phi}$. How do we get new iterates for $k$? To sort that out, we're going to think about the physical interpretation of $k$.

The multiplication factor, $k$, can be defined as
\[k = \frac{\text{total production rate}}{\text{total loss rate}}\]
%
We can define two \textbf{operators} (\emph{not matrices}; to get the thing that we solve, we apply our specific discretization methods to turn the operators into matrices) to help us compute this:
%
\begin{align}
A &= -\frac{d}{dx}D(x)\frac{d}{dx} + \Sigma_a(x) \quad \text{is the loss operator,} \nonumber \\
F &= \nu\Sigma_f(x) \qquad \qquad \text{is the production operator.}\nonumber
\end{align}

%Fortunately, the discretized versions of these operators are the matrices that we have $\ve{A}$ and $\ve{F}$, respectively.
This allows us to write an equation for $k$ as
\ifprintanswers
\[k^{(m+1)} = \frac{\int_0^{\tilde{a}} F \vec{\phi}^{(m+1)}(x)dx}{\int_0^{\tilde{a}} A \vec{\phi}^{(m+1)}(x)dx}\:. \]
\else
\\ \vspace*{3em}
\fi

We can express our iterative method with our operators,
\[ A \vec{\phi}^{(m+1)} = \frac{1}{k^{(m)}}F\vec{\phi^{(m)}}\]
%
and substitute this into our $k$ equation to get
\[k^{(m+1)} = \frac{\int_0^{\tilde{a}} F \vec{\phi}^{(m+1)}(x)dx}{\frac{1}{k^{(m)}}\int_0^{\tilde{a}} F \vec{\phi}^{(m)}(x)dx\:.} \]
%
This idea applies to any discretization strategy. To use the finite difference formulation we've developed, we discretize the operators and this can be expressed as:
\ifprintanswers
\[k^{(m+1)} = k^{(m)}\Biggl(\frac{\nu\Sigma_{f,1} \phi_0^{(m+1)} \frac{h_1}{2} + \sum_{i=1}^{n-1} \nu\Sigma_{f,ii} \phi_i^{(m+1)} \frac{h_{ii}}{2}}
{\nu\Sigma_{f,1} \phi_0^{(m)} \frac{h_1}{2} + \sum_{i=1}^{n-1} \nu\Sigma_{f,ii} \phi_i^{(m)} \frac{h_{ii}}{2}}\Biggr)\:.\]
\else
\\ \vspace*{3em}
\fi

\subsection*{Power Method}

Power Iteration (PI) is an old and straightforward algorithm for finding an eigenvalue/vector pair.

The basic idea is that any non-zero vector can be written as a linear combination of the eigenvectors of $\ve{B}$ because the eigenvectors are linearly independent, namely $\vec{v}_0 = \gamma_1 \vec{x}_1 + \gamma_2 \vec{x}_2 + \cdots + \gamma_n \vec{x}_n$, where $\vec{x}_{j}$ is the $j$th eigenvector and $\gamma_{j}$ is some constant. This specific expression assumes a non-defective $\ve{B}$, though this assumption is not necessary for the method to work.

Another fact that is used to understand power iteration is that $\ve{B}^m \vec{x}_i = \lambda_i^m \vec{x}_i$. Thus
%
\begin{equation}
  \ve{B}^m \vec{v}_{0} = \gamma_1 \lambda_1^m \vec{x}_1 + \gamma_2 \lambda_2^m \vec{x}_2 + \cdots + \gamma_n \lambda_n^m \vec{x}_n \:.\nonumber
  \label{eq:Ak}
\end{equation}
%
Since $|\lambda_1| > |\lambda_i|, i \ne 1$, the first term in the expansion will dominate as $m \to \infty$ and $\ve{B}^m \vec{v}_{0}$ therefore becomes an increasingly accurate approximation to $\vec{x}_1$.

In practice, it is desirable to avoid exponentiating a matrix, so we will use an algorithm that does something else. It is also helpful to normalize $\vec{v}_0$ to avoid possible over or underflow.

We are also quite interested in the \textit{convergence behavior} of PI. After $m$ steps, the iteration vector $\vec{v}$ will be:
%
\ifprintanswers
\begin{equation}
  \vec{v}_{m} = \bigl( \frac{\lambda_{1}^{m}}{\vec{e}_{1}^{T}\ve{B}^{m}\vec{v}_{0}} \bigr) \bigl(\frac{1}{\lambda_{1}^{m}}\ve{B}^{m}\vec{v}_{0} \bigr) \:' \nonumber
\end{equation}
\else
\\ \vspace*{2em}
\fi

%
where $\vec{e}_{1}^{T}$ is a vector with 1 in the first entry and zeros elsewhere; it selects the first row of $\ve{B}$ in the multiplication. If $\ve{B}$ has eigenpairs $\{(\vec{x}_{j}, \lambda_{j}), 1 \le j \le n \}$ and $\vec{v}_{0}$ has the expansion $\vec{v}_{0} = \sum_{j=1}^{n} \vec{x}_{j}\gamma_{j}$ then
%
\begin{equation}
  \frac{1}{\lambda_{1}^{m}}\ve{B}^{m}\vec{v}_{0} =  \frac{1}{\lambda_{1}^{m}} \sum_{j=1}^{n} \ve{B}^{m}\vec{x}_{j}\gamma_{j} = \sum_{j=1}^{n} \bigl(\frac{\lambda_{j}}{\lambda_{1}} \bigr)^m \vec{x}_{j} \gamma_{j} \:.
  \label{eq:PIexpand}
\end{equation}
%
\ifprintanswers
From equation \eqref{eq:PIexpand} it can be determined that the error is reduced in each iteration by a factor of $|\frac{\lambda_{2}}{\lambda_{1}}|$, which is called the dominance ratio. If $\lambda_2$ is close to $\lambda_1$, then this ratio will be close to unity and the method will converge very slowly.

If $\lambda_2$ is far from $\lambda_1$, then convergence will happen much more quickly. Put simply, PI is better suited for problems where $\ve{B}$ has eigenvalues that are well separated.
\else
\vspace*{8em}
\fi

Power iteration is very attractive because it only requires matrix-vector products and two vectors of storage space. Because of its simplicity and low storage cost, PI has been widely used in the transport community for criticality problems for quite some time.

Despite these beneficial characteristics, many current codes use an acceleration method with PI or have moved away from it altogether because of the slow convergence for many problems of interest. Nevertheless, it is still used in some codes, has historical relevance, and is used in many studies as a base comparison case.

\subsubsection*{Algorithm}

The power method applies in our formulation when $\ve{B} \equiv \ve{A}^{-1}\ve{F}$, $\lambda \equiv k$ and $\vec{x} \equiv \vec{\phi}$.
%
When we write it this way it is technically \textbf{inverse power iteration} because we're using the inverse of $\ve{A}$ rather than $\ve{A}$ (the theory is the same). Be careful when setting up these solvers about whether you are solving for $k$ or $1/k$ to ensure you get the correct eigenvectors.

Here is an algorithm to implement the power method (note: this is not the most efficient way to do this, but it is likely the clearest).
%
\begin{enumerate}
\item get initial values for $k^{(0)}$ and $\phi^{(0)}$ for $i = 0, \dots, n-1$; normalize $\phi_0 = \phi_0 / ||\phi_0||$

\item compute the elements of $\ve{A}$

\item compute the initial fission source
\[\vec{Q}_{f}^{(0)} = \begin{pmatrix}
Q_{f,0}^{(0)} \\ Q_{f,1}^{(0)} \\ \vdots \\ Q_{f,n-1}^{(0)} \\
\end{pmatrix}\]
%
where $Q_{f,i}^{(0)} = \nu\Sigma_{f,ii}\phi_i^{(0)} \: \text{for } i = 1, \dots, n-1$ and $Q_{f,0}^{(0)} = \nu\Sigma_{f,1}\phi_0^{(0)}$

\item for $m = 1, ...,$ convergence:
\begin{enumerate}
\item solve (using a method like Jacobi or GS)
\[\ve{A} \vec{\phi}^{(m)} = \frac{1}{k^{(m-1)}}\vec{Q}_{f}^{(m-1)}\]

\item compute the next fission source $\:Q_{f,i}^{(m)} = \nu\Sigma_{f,ii}\phi_i^{(m)} \: \text{ for } i = 1, \dots, n-1$ and\\ $Q_{f,0}^{(m)} = \nu\Sigma_{f,1}\phi_0^{(m)}$

\item compute the next eigenvalue:
\[k^{(m)} = k^{(m-1)}\Biggl(\frac{Q_{f,0}^{(m)} \frac{h_1}{2} + \sum_{i=1}^{n-1} Q_{f,i}^{(m)} \frac{h_{ii}}{2}}
{Q_{f,0}^{(m-1)} \frac{h_1}{2} + \sum_{i=1}^{n-1} Q_{f,i}^{(m-1)} \frac{h_{ii}}{2}}\Biggr)\]

\item check for convergence
\begin{align}
\bigg|\frac{k^{(m)} - k^{(m-1)}}{k^{(m)}}\bigg| &< \epsilon_1 \nonumber \\
\bigg|\frac{\phi_i^{(m)} - \phi_i^{(m-1)}}{\phi_i^{(m)}}\bigg| &< \epsilon_2 \nonumber
\end{align}

\end{enumerate}
\end{enumerate}

%--------------------------------------------------------------------
%--------------------------------------------------------------------
%\bibliographystyle{plain}
%\bibliography{LinearSolns}

\end{document}


\documentclass[12pt]{article}
\usepackage{epsfig}
\usepackage{amssymb}
\textwidth=17cm
\textheight=22.5cm

\topmargin -1.5 cm
\oddsidemargin -0.3cm

\parskip 0.3cm
 \begin{document}

\vspace*{20mm}
\begin{flushright}
CERN-TH/2000.015
\end{flushright}
\vspace*{1cm}
\begin{center}
{\bf CONTINUATION OF DIRECT PRODUCTS OF DISTRIBUTIONS}
\vspace*{1cm}

{\bf A. Peterman }\\
\vspace{0.3cm}
Theoretical Physics Division,
CERN \\
CH -- 1211 Geneva 23\\
\vspace*{2cm}
 \end{center}

\setcounter{page}{1}
\pagestyle{plain}

\begin{center}{\bf Preamble}\end{center}
If, in some problems, one has to deal with the ``product'' of
distributions
$\rm f_i$ (also called
generalized functions) $\rm\overline T = \Pi^m_{i=1} f_i$, this product
has
a priori no definite meaning
as a functional $(\rm \overline T, \varphi) $ for $\rm\varphi \in S$. But
if $\rm x^{\kappa +1}
\Pi^m_{i=1} f_i$ exists, whatever the associativity is  between some
powers
$\rm r_i$ of $\rm x$ ($\rm
r_i
\in \Bbb N, \sum_i r_i\leq \kappa  +1, r_i \geq 0$) and the various $\rm
f_i$, then a continuation
of the  linear functional $\rm \overline T$ from $\rm M$  onto $\rm
S^{(N)}$  for some $\rm N$
is shown to exist\footnote{$\rm M$ is a closed subspace of $\rm S^N$ for
some $\rm N$. It is a Banach
space with norm
$\rm \|
\|_N $.} in such a way that $\rm x^{\kappa +1} \overline T$ is defined
unambiguously, and $\rm (\overline
T,
\varphi), \varphi \in S$, significant, though not unique.
\vspace*{4cm}
\begin{flushleft}
CERN-TH/2000-015\\
January 2000
\end{flushleft}
\vfill\eject

\section{Existence}

In the sense of convergence in the space $\rm S^*$ (distributions),
$$\rm f_\kappa = \lim_{y \rightarrow 0,\; y \in C^+} F^y_\kappa (x)
\;;\;\;
\kappa = 1,2, \cdots ,
m\;,$$
 with $\rm F^y_\kappa (x) = f^+_\kappa (x +iy) - f^-_\kappa (x - i y)$,
$\bigg(\rm f^\pm_\kappa (x)$ are
holomorphic in tabular domains $\rm T^{C^\pm_R}$ and satisfy
\begin{equation}
|f (x + i y) | \leq C (R^\prime, C^\prime) |y|^{-\alpha} (1+|x|)^\beta
\end{equation}
and
$$
z \in R^n + i (C^\prime
\cap U (0, R^\prime))
$$
$\rm \alpha , \beta \geq 0$, independent of $\rm R^\prime$ and $\rm
C^\prime$. From this, it follows that
there exists in $\rm S^*$ a unique boundary value
$$\left.{\rm f(x) = \lim_{y \rightarrow 0 , \; y \rightarrow c} f(x + iy)
 \in S^{(m) *}; \; m= \alpha +\beta +
n +3\;.}\right)$$

Let us suppose that for arbitrary  $\rm \varphi \in S$ there exists a
finite limit
\begin{equation}
\lim_{y \rightarrow 0, \;y\in C^+} \int  F_1^y (x) \cdots F^y_m (x) \cdot
\varphi (x) dx
\end{equation}
independent of the sequence $\rm y \rightarrow 0 , \; y \in C^+$. Then,
since the space $\rm S^*$ is
dense, this limit defines a distribution in $\rm S^*$ which we call the
product $\rm f_1 . f_2 .\cdots
.f_m$ of the distributions $\rm f_1, f_2,\cdots , f_m$. Thus
\begin{equation}
f_1. f_2. \cdots . f_m = \lim_{y\rightarrow 0 , \; y \in C^+} F^y_1 \cdots
F^y_m\;\;({\rm in}\; S^*)
\end{equation}
if the limit of the RHS exists and is independent of the sequence $\rm y
\rightarrow 0 , y \in C^+$.
This product is obviously commutative and associative. So  the set of
boundary values that are
holomorphic in $\rm T^{C^+_R}$ and satisfy (1) constitute a commutative
ring with unity, without zero
divisors with respect to the multiplication defined above.

We note that the existence of the lim in (2) for $\rm \varphi \in S$
implies the existence of the
limit in (3) with respect to the norm of the functional in $\rm S^{(N)*}$
for some $\rm N$, which depends
on
$\rm f_1 \dots f_m$ (notice that weak convergence in $\rm S^*$ implies
strong convergence).

\section{General case}

Suppose now that (2) does not exist for all $\rm \varphi \in S$, but that
it exists for all $\rm \varphi$
in a closed subspace  $\rm M$ of $\rm S^{(N)}$ for some $\rm N$. (Since
$\rm M$ is closed in $\rm
S^{(N)}$ it is a Banach space with norm $\rm \|\;\|_N$). From the
Banach-Steinhaus theorem, (2) defines a
continuous linear functional $\rm \overline T$ on $\rm M$. We use now the
term `product' $\rm f_1.
\cdots . f_m$ of the distributions $\rm f_1, f_2, \cdots , f_m$ for
\underline{any} continuous linear
functional in the space $\rm S^{(N)*}\subset S^*$ that is a
\underline{continuation} of $\rm \overline T$
from
$\rm M$ to
$\rm S^{(N)}$. According to the Hahn-Banach theorem, such an extension
always exists but is not
\underline{unique} in general.

We shall concentrate now on the case of those $\varphi$ in $\rm S^{(N)}$
that vanish together with
all derivatives of order $\rm p\leq N$ inclusively, at $\rm x=0$. In this
case, \underline{all}
continuations
  $\rm f_1. f_2. \cdots . f_m$ of $\rm \overline T$ from $\rm M$ onto $\rm
S^{(N)}$ are given by
\begin{equation}
(f_1. f_2 . \cdots . f_m, \varphi ) = (\overline{T}, \overline{\varphi}) +
\sum_{\kappa \leq p}
c_\kappa (\delta^{(\kappa)}, \varphi)
\end{equation}
where
$$\rm \overline{\varphi} (x) = \varphi (x) - \sum_{\kappa \leq p}
\varphi^{(\kappa )} (o) \omega (x)
\frac{x^\kappa}{\kappa^!}$$
and $\rm \omega (x)$ is an arbitrary function, $\rm \omega \in S$,
identically equal to 1 in a
neighbourhood of the point $\rm x =0$; the $\rm c_\kappa$ are arbitrary
constants. (Notice that the
extension (4) is actually independent of $\rm \omega (x)$).

In conclusion, the formula (4) represents the desired result, given at the
end of the preamble
with $\rm \sum_{\kappa \leq p} c_\kappa \delta^{(\kappa)}$ the general
solution of $\rm (f_1. \cdots .
f_m, \varphi) =0$ and $\rm ( {T}, \overline{\varphi} ) = (\overline{T},
x^{\kappa +1} \psi) =
(x^{\kappa +1} \overline{T}, \psi ), \psi \in S$, a particular solution of
$\rm (f_1.\cdots . f_m,
\varphi )$.

It is therefore shown that the solution (4) is not unique, the $\rm
c_\kappa$ being arbitrary
constants.
\end{document}


\documentclass[12pt]{article}
\usepackage{verbatim}
\usepackage{charter}

\title{Summary of the {\tt res\_quan} library}
\author{W. Wong}
\date{15 April 1993}

\input{summacs}

\begin{document}
\maketitle

The {\tt res\_quan} library privides some basic facilities for
manipulate restricted quantifications. It consists of a single theory,
{\tt res\_quan}, which  contains a number of theorems about the
properties of some restricted quantifiers, and a set of ML functions
for dealing with them. This summary lists all theorem stored in the
{\tt res\_quan} theory and ML functions available in the library.

\section{The theory {\tt res\_quan}}

This theory caontains the following theorems.
{\small
% =====================================================================
% Commands for typesetting theorems
% =====================================================================

\makeatletter

% ---------------------------------------------------------------------
% define \@xboxverb<thing>\ENDTHEOREM to mean <thing>\ENDTHEOREM
% ---------------------------------------------------------------------

\begingroup \catcode `|=0 \catcode `[= 1
\catcode`]=2 \catcode `\{=12 \catcode `\}=12
\catcode`\\=12 |gdef|@xboxverb#1\ENDTHEOREM[#1|ENDTHEOREM]
|endgroup

% ---------------------------------------------------------------------
% \bboxverb<thing> = <thing> in a verbatim box 5mm from left margin
% ---------------------------------------------------------------------

\def\@boxverb{\bgroup\leftskip=5mm\parindent\z@
\parfillskip=\@flushglue\parskip\z@
\obeylines\tt \catcode``=13 \@noligs \let\do\@makeother \dospecials}

\def\boxverb{\@boxverb \frenchspacing\@vobeyspaces \@xboxverb}

% ---------------------------------------------------------------------
% \ENDTHEOREM just finishes off the group (and kick page if necessary)
% ---------------------------------------------------------------------

\def\ENDTHEOREM{\egroup\filbreak}

% ---------------------------------------------------------------------
% \THEOREM <name> <thy> ... \ENDTHEOREM = typeset a theorem
% ---------------------------------------------------------------------
\def\autoindex#1{}
\def\THEOREM #1 #2 {
 \autoindex{#1@{\tt #1}}
   \vspace{4mm plus2mm minus1mm}
   \noindent {\tt #1}\quad ({\tt #2}) \par \boxverb
}

\makeatother

\THEOREM DISJ\_RESQ\_EXISTS\_DIST res\_quan
|- !P Q R.
   (?i :: \i. P i \/ Q i. R i) = (?i :: P. R i) \/ (?i :: Q. R i)
\ENDTHEOREM
\THEOREM RESQ\_EXISTS\_DISJ\_DIST res\_quan
|- !P Q R. (?i :: P. Q i \/ R i) = (?i :: P. Q i) \/ (?i :: P. R i)
\ENDTHEOREM
\THEOREM RESQ\_EXISTS\_REORDER res\_quan
|- !P Q R. (?i :: P. ?j :: Q. R i j) = (?j :: Q. ?i :: P. R i j)
\ENDTHEOREM
\THEOREM RESQ\_EXISTS\_UNIQUE res\_quan
|- !P j. (?i :: $= j. P i) = P j
\ENDTHEOREM
\THEOREM RESQ\_FORALL\_CONJ\_DIST res\_quan
|- !P Q R. (!i :: P. Q i /\ R i) = (!i :: P. Q i) /\ (!i :: P. R i)
\ENDTHEOREM
\THEOREM RESQ\_FORALL\_DISJ\_DIST res\_quan
|- !P Q R.
   (!i :: \i. P i \/ Q i. R i) = (!i :: P. R i) /\ (!i :: Q. R i)
\ENDTHEOREM
\THEOREM RESQ\_FORALL\_FORALL res\_quan
|- !P R x. (!x. !i :: P. R i x) = (!i :: P. !x. R i x)
\ENDTHEOREM
\THEOREM RESQ\_FORALL\_REORDER res\_quan
|- !P Q R. (!i :: P. !j :: Q. R i j) = (!j :: Q. !i :: P. R i j)
\ENDTHEOREM
\THEOREM RESQ\_FORALL\_UNIQUE res\_quan
|- !P j. (!i :: $= j. P i) = P j
\ENDTHEOREM
}

\section{ML functions in the library}

\subsection*{Conditional rewriting tools}

\begin{itemize}
\item \mlname{COND_REWRITE1_CONV} \verb|: (thm list -> thm -> conv)|\newline
A simple conditional rewriting conversion.

\item \mlname{COND_REWRITE1_TAC} \verb|: thm_tactic|\newline
A simple conditional rewriting tactic.

\item \mlname{COND_REWR_CANON} \verb|: thm -> thm|\newline
Transform a theorem into a form accepted by \mlname{COND_REWR_TAC}.

\item \mlname{COND_REWR_CONV} \linebreak
\verb|: ((term -> term ->| \verb|((term # term) list # (type # type) list) list)|
\verb| -> thm -> conv)|\newline
A lower level conversion implementing simple conditional rewriting.

\item \mlname{COND_REWR_TAC}\linebreak
\verb|: ((term -> term ->| \verb|((term # term) list # (type # type) list) list)|
\verb|-> thm_tactic)|\newline
A lower level tactic used to implement simple conditional rewriting tactic.
\end{itemize}

\subsection*{Syntax functions}

\begin{itemize}
\item \mlname{mk_resq_abstract} \verb|: ((term # term # term) -> term)|\newline
Term constructor for restricted abstraction.

\item \mlname{mk_resq_exists} \verb|: ((term # term # term) -> term)|\newline
Term constructor for restricted existential quantification.

\item \mlname{mk_resq_forall} \verb|: ((term # term # term) -> term)|\newline
Term constructor for restricted universal quantification.

\item \mlname{mk_resq_select} \verb|: ((term # term # term) -> term)|\newline
Term constructor for restricted choice quantification.

\item \mlname{list_mk_resq_exists} \verb|: ((term # term) list # term) -> term)|\newline
Iteratively constructs a restricted existential quantification.

\item \mlname{list_mk_resq_forall} \verb|: ((term # term) list # term) -> term)|\newline
Iteratively constructs a restricted universal quantification.

\item \mlname{dest_resq_abstract} \verb|: (term -> (term # term # term))|\newline
Breaks apart a restricted abstract term into
quantified variable, predicate and body.

\item \mlname{dest_resq_exists} \verb|: (term -> (term # term # term))|\newline
Breaks apart a restricted existentially quantified term into
quantified variable, predicate and body.

\item \mlname{dest_resq_forall} \verb|: (term -> (term # term # term))|\newline
Breaks apart a restricted universally quantified term into
quantified variable, predicate and body.

\item \mlname{dest_resq_select} \verb|: (term -> (term # term # term))|\newline
Breaks apart a restricted choice quantified term into
quantified variable, predicate and body.

\item \mlname{strip_resq_exists} \verb|: (term -> ((term # term) list # term))|\newline
Iteratively breaks apart a restricted existenially quantified term.

\item \mlname{strip_resq_forall} \verb|: (term -> ((term # term) list # term))|\newline
Iteratively breaks apart a restricted universally quantified term.

\item \mlname{is_resq_abstract} \verb|: (term -> bool)|\newline
Tests a term to see if it is a restricted abstraction.

\item \mlname{is_resq_exists} \verb|: (term -> bool)|\newline
Tests a term to see if it is a restricted existential quantification.

\item \mlname{is_resq_forall} \verb|: (term -> bool)|\newline
Tests a term to see if it is a restricted universal quantification.

\item \mlname{is_resq_select} \verb|: (term -> bool)|\newline
Tests a term to see if it is a restricted choice quantification.
\end{itemize}

\subsection*{Derived rules}

\begin{itemize}
\item \mlname{RESQ_GEN} \verb|: ((term # term) -> thm -> thm)|\newline
Generalizes the conclusion of a theorem to a restricted universal quantification.

\item \mlname{RESQ_GENL} \verb|: ((term # term) list -> thm -> thm)|\newline
Generalizes zero or more variables to restricted universal quantification
in the conclusion of a theorem.

\item \mlname{RESQ_GEN_ALL} \verb|: (thm -> thm)|\newline
Generalizes the conclusion of a theorem over its own assumptions.

\item \mlname{RESQ_HALF_EXISTS} \verb|: (thm -> thm)|\newline
Strip a restricted existential quantification in the conclusion of a theorem.

\item \mlname{RESQ_HALF_SPEC} \verb|: (thm -> thm)|\newline
Strip a restricted universal quantification in the conclusion of a theorem.

\item \mlname{RESQ_MATCH_MP} \verb|: (thm -> thm -> thm)|\newline
Eliminating a restricted universal quatification with automatic matching.

\item \mlname{RESQ_REWR_CANON} \verb|: thm -> thm|\newline
Transform a theorem into a form accepted for rewriting

\item \mlname{RESQ_SPEC} \verb|: (term -> thm -> thm)|\newline
Specializes the conclusion of a restricted universally quantified theorem.

\item \mlname{RESQ_SPECL} \verb|: (term list -> thm -> thm)|\newline
Specializes zero or more variables in the conclusion of a restricted
universally quantified theorem.

\item \mlname{RESQ_SPEC_ALL} \verb|: (thm -> thm)|\newline
Specializes the conclusion of a theorem with its own quantified variables.
\end{itemize}

\subsection*{Conversions}

\begin{itemize}
\item \mlname{AND_RESQ_FORALL_CONV} \verb|: conv|\newline
Moves a restricted universal quantification out a conjunction.

\item \mlname{IMP_RESQ_FORALL_CONV} \verb|: conv|\newline
Converts an implication to a restricted universal quantification.

\item \mlname{LIST_RESQ_FORALL_CONV} \verb|: conv|\newline
Converts restricted universal quantifications iteratively to implications.

\item \mlname{RESQ_EXISTS_CONV} \verb|: conv|\newline
Converts a restricted existential quantification to a conjunction.

\item \mlname{RESQ_FORALL_AND_CONV} \verb|: conv|\newline
Splits a restricted universal quantification across a conjunction.

\item \mlname{RESQ_FORALL_CONV} \verb|: conv|\newline
Converts a restricted universal quantification to an implication.

\item \mlname{RESQ_FORALL_SWAP_CONV} \verb|: conv|\newline
Changes the order of two restricted universal quantifications.

\item \mlname{RESQ_REWRITE1_CONV} \verb|: thm list -> thm -> conv|\newline
Rewriting conversion with restricted universally quantified theorem.
\end{itemize}

\subsection*{Tactics}

\begin{itemize}
\item \mlname{RESQ_GEN_TAC} \verb|: tactic|\newline
Strips the outermost restricted universal quantifier from
the conclusion of a goal.

\item \mlname{RESQ_HALF_GEN_TAC} \verb|: tactic|\newline
Strips the outermost restricted universal quantifier from
the conclusion of a goal.

\item \mlname{RESQ_EXISTS_TAC} \verb|: term -> tactic|\newline
Strips the outermost restricted extistential quantifier from
the conclusion of a goal.

\item \mlname{RESQ_IMP_RES_TAC} \verb|: thm_tactic|\newline
REpeatedly resolves a restricted univerally quantified theorem with
the assumptions of a goal.

\item \mlname{RESQ_IMP_RES_THEN} \verb|: thm_tactical|\newline
Resolves a restricted univerally quantified theorem with
the assumptions of a goal.

\item \mlname{RESQ_RES_TAC} \verb|: tactic|\newline
Enriches assumptions by repeatedly resolving restricted universal
quantifications in them against the others.

\item \mlname{RESQ_RES_THEN} \verb|: thm_tactic -> tactic|\newline
Resolves all restricted univerally quantified assumptions against
other assumptions of a goal.

\item \mlname{RESQ_REWRITE1_TAC} \verb|: thm_tactic|\newline
Rewriting with restricted universally quantified theorem.
\end{itemize}

\subsection*{Constant definition}

\begin{itemize}
\item \mlname{new_binder_resq_definition} \verb|: ((string # term) -> thm)|\newline
Declare a new binder and install a definitional axiom in the current theory.

\item \mlname{new_infix_resq_definition} \verb|: ((string # term) -> thm)|\newline
Declare a new infix constant and install a definitional axiom in the current theory.

\item \mlname{new_resq_definition} \verb|: ((string # term) -> thm)|\newline
Declare a new constant and install a definitional axiom in the current theory.
\end{itemize}

\end{document}


% !TEX root = zeth_relay

\chapter{Network structure}\label{chap:unicast-vs-broadcast}

\section{Binding requests to relays}

\subsection{Background}

The protocols presented in this document require users to create relay requests that can only be successfully processed by a specific relay. This serves as a mechanism to prevent other network participants from ``stealing'' the relay requests or front-running relay transactions. The alternative to this would be to support ``free'' relay requests, not bound to specific relays, which could therefore be processed by any participant. If these ``free'' requests are made available (or ``broadcast'') to multiple relays, those relays must then ``race'' to process the request and broadcast a corresponding relay transaction. When the first relay transaction is accepted by the blockchain, the ``winning'' relay will receive the relay fee and later transactions from other relays will be rendered invalid (as a consequence of the nullifiers declared in the $\zeth$ relay request being marked as used).

While such an approach is entirely feasible, it increases the risk for relays, making it much harder for them to hedge against lost fees and wasted compute resources. As a consequence, it becomes much more difficult for relays to assess the risk associated with a given request, which in turn is likely to result in an increase in relay fees. All resources used by ``losers'' of the race are wasted.  In contrast, in the case where requests are bound to specific relays, these resources can be used to process multiple requests in parallel, increasing the efficiency of the system.

\subsection{Emulating ``free'' relay requests}\label{unicast-vs-broadcast:requests:emulate-free-requests}

Despite the mechanisms to prevent front-running, the protocols presented in this document could be leveraged by some user (say $\userP$) to force relays to ``compete'' for relay requests.
Specifically, in order to call the \zeth~mixer \mixer~with parameters $\mixparams$, $\userP$ can run multiple instances of a protocol in parallel, generating $N$ relay requests for $\mixparams$, each targeting a different relay. If the user then sends each of these $N$ requests to the targeted relay, the desired state transition will be carried out by the first relay transaction to be accepted into the blockchain, rendering the remaining $N-1$ requests invalid (by the nullifier mechanism cited previously).

As in the case of ``free'' requests, relays are exposed to extra risk for the reasons given above. However, this ``emulating'' approach does provide partial mitigation of this risk, due to the extra cost that the user $\userP$ must incur. Under the protocols given in this document, in order to create $N$ requests targeting different relays, the user must generate $N$ zk-SNARKs, which is computationally demanding and therefore represents a cost to the user. Therefore, request generation may act as a user-side proof-of-work, preventing malicious messages from flooding the network (as originally designed for by Dwork et al.~\cite{DBLP:conf/crypto/DworkN92,Jakobsson1999ProofsOW}). This naturally leads to the following process by which relays can partially protect against some DoS vectors, by performing the following checks on relay requests:
\begin{enumerate}
    \item Verify that none of the nullifiers in the request has been seen in previously received requests (inspect the mempool and the blockchain state). If one or more nullifiers is a duplicate then reject the request, else proceed.
    \item Verify the zk-SNARK proof in the request. If the proof is invalid, reject the request. Otherwise the request can be considered for processing.
\end{enumerate}

In this way, the cost of generating $N$ proofs imposes some upper bound on the message output rate of a potential attacker.

\section{Unicast vs broadcast networks}\label{unicast-vs-broadcast:unicast-vs-broadcast}

The discussions in this document assume only that some transport mechanism exists for users to send relay requests to specific relays. As noted in \cref{preliminaries:introduction}, users can achieve further anonymity if this transport mechanism does not require the user to reveal any identifying information at the network level. We now discuss some specific implementations of the transport layer (namely ``unicast'' vs ``broadcast'' networks), and their respective properties.

By design, relay requests are bound to specific relays, which intuitively implies a ``unicast'' style transport mechanism. That is, relays publish a network address of some form, and users send requests to this address. Observers of the physical network may determine that a message has been sent from the user to the relay, but the content of the message (i.e.~the details of the relay request) is not visible to other participants. This is a natural choice given that relay request data cannot be used by parties other than the targeted relay. While not a requirement of any of these protocols, unicast channels (in particular point-to-point communication channels, which we assume to be encrypted by default) only reveal the relay request content to the relay itself. Adversaries able to gain control a physical network node along the route between user and relay (in general a limited set of nodes, which varies depending on user and relay) may learn that a message was sent from the user to the relay, but they will not learn anything about the message content. Such communication channels also allow for interaction between relay and user (for example, the relay could dynamically select an \ethereum~or \zeth~address to receive payment, or privately negotiate fees with the user).

Clearly it would be entirely possible to implement these protocols using a ``broadcast'' system, such as those employed by blockchains to propagate transactions and blocks. Requests could be broadcast unencrypted without impacting the reliability of the system, as long as messages were eventually seen by the target relay. Broadcast networks provide some inherent receiver anonymity, in the sense that it is more difficult to identify which \emph{network node} is the recipient of a given message, however in this setting, all participants in the system would be able to see the content of relay requests and potentially determine the number of requests received by each relay identity (and, in turn, infer information about their profit). Despite relay requests being visible to other participants, the protocol would still prevent other relays from profiting from these requests, since they are bound to the target relay. Further, the content of requests could be hidden by encryption so that only the intended relay may read them. Instead of publishing a network ``address'' of some form, relays could publish an encryption key, with which users must encrypt requests before broadcasting them (although care must be taken to use a key-private encryption scheme to avoid leaking information about the recipient).

While broadcast networks could theoretically be used in these relay protocols, unicast networks are more bandwidth efficient (i.e.~a given message needs only to find a path through the network in order to flow from the sender to the recipient). In contrast, broadcast networks may provide a level of sender anonymity in the face of network observers, although even in broadcast networks methods exist to infer the message originator (e.g.~nodes with high degree\footnote{In the graph theoretical sense.} -- also referred to as ``supernodes'' -- can be used to infer the sender of a message on a broadcast channel by using timing information~\cite{DBLP:conf/fc/KoshyKM14}). Broadcast communication channels are also of great interest to achieve ``recipient anonymity''(see~\cite{DBLP:journals/compsec/PfitzmannW87} for more details on ``anonymity'').

At first sight, the use of a unicast transport may appear to increase the centralization of the system. However, this is demonstrably not the case for the protocols discussed here, which can (as described above) be implemented using a transparent broadcast network and do not inherently rely on any centralization.

Finally, we note that, although broadcast networks could theoretically be used, we suggest that unicast networks are likely to be more suitable, given their lower bandwidth and complexity.

\section{Network anonymity}\label{unicast-vs-broadcast:network-anonymity}

Relay protocol designers may choose to transmit requests via the method that best fits their needs, taking into consideration the tradeoffs mentioned in \cref{unicast-vs-broadcast:unicast-vs-broadcast} above. As well as overhead, network topology also has a strong influence on anonymity~\cite{DBLP:conf/pet/DiazMT10}). However, in order to achieve strong privacy guarantees, anonymisation techniques (e.g.~cover traffic, message padding etc.) must be used, to minimize communication leakages.

While protocols like Dandelion~\cite{DBLP:journals/pomacs/Venkatakrishnan17,DBLP:journals/pomacs/FantiVBDBMV18} were initially introduced to improve \emph{diffusion} mechanisms and improve network anonymity on Bitcoin, they could also be of interest in the context of relay request broadcasts (as alluded to in~\cref{unicast-vs-broadcast:unicast-vs-broadcast}).
However, other techniques (providing different properties) may also be of interest for relay network. Some of these are given below:
\begin{itemize}
    \item DC-nets~\cite{DBLP:journals/joc/Chaum88} provide strong guarantees with respect to the sender anonymity (but generally incur a big overhead and require large amounts of randomness).
    \item Crowds~\cite{DBLP:journals/tissec/ReiterR98} follow a ``blending into a crowd'' approach (i.e.~hiding one's actions among the actions of many others), in which a user's request is randomly circulated in a ``crowd'' (set of users) before being submitted -- by a random member of the crowd -- and sent to the destination\footnote{Crowd members \emph{cannot} identify the initiator of the request. The initiator is indistinguishable from a member that forwards a request from another user.}. Note that such approaches generally do not provide strong guarantees with respect to recipient anonymity\footnote{While relay anonymity is not our principal focus, it is worth keeping in mind the impact of side channel leakages which can be used to infer information about the sender. For instance, a powerful adversary -- monitoring a big part of the Internet -- may notice a client access the relay's public information (such as the relay's website) followed by a message to the relay from a crowd to which the client belongs. The adversary may then infer that the client was the relay user. Hence, additional care needs to be allocated to the relay discovery mechanism itself, and the right trade-offs must be made depending on the application and associated threat model.}.
    \item Mix networks (or \emph{mixnets})~\cite{DBLP:series/ais/Chaum03}, in which nodes (``mix nodes'') are routers that perform cryptographic operations (providing bit-wise unlinkability), and modify the order in which output messages are emitted. This hides any correspondence between input and output messages.
    \item Onion routing~\cite{DBLP:journals/cacm/GoldschlagRS99} (which also underlies ``garlic routing''~\cite{garlic-nets}) consists of multiple layers of encryption (one per ``hop'' on the network). Requests are sent through a chosen set of routers (forming a ``circuit'') in order to obfuscate the link between sender and recipient, as seen by non-global adversaries (i.e.~those that do not control all nodes on the circuit\footnote{In some cases, controlling the ``entry'' and ``exit'' nodes (i.e.~first and last nodes of the chain/circuit) is sufficient to carry out so-called ``correlation attacks''. See~\url{https://github.com/Attacks-on-Tor/Attacks-on-Tor} for a list of attacks on Tor~\cite{DBLP:conf/uss/DingledineMS04}}). This generally achieves low-latency relative to other approaches.
\end{itemize}

Importantly, modern protocols building on these techniques use additional mechanisms for enhanced robustness (e.g.~``cover traffic'' to prevent timing attacks etc.).

\begin{remark}
    We note that accountable anonymous communication networks~\cite{DBLP:books/sp/07/DiazP07} are also of great interest in the context of transaction relay protocols as a way to further prevent DoS attacks.
\end{remark}


\section{Introduction}

\begin{frame}{Introduction}
  \textbf{Edit distance:}
  \begin{itemize}
    \item<2->
      Measurement for similarity of two words / strings
    \item<3->
      Algorithm for efficient calculation
    \item<4->
      General principle: dynamic programming
  \end{itemize}
\end{frame}

%-------------------------------------------------------------------------------

\begin{frame}{Introduction}{Motivation: Error tolerant string comparison}
  \begin{adjustbox}{width=\linewidth}
    \includegraphics[width=\linewidth]%
      {Images/Introduction/Search_Volcano.pdf}
  \end{adjustbox}
\end{frame}

%-------------------------------------------------------------------------------

\begin{frame}{Introduction}{Motivation}
  \textbf{A lot of applications where similar string are searched:}
  \begin{itemize}
    \item<2->
      Duplicates in databases:\\[0.5em]
      \begin{tabular}{ll}
        \texttt{Hein Bl\"od} & \texttt{27568 Bremerhaven}\\
        \texttt{Hein Bloed} & \texttt{27568 Bremerhafen}\\
        \texttt{Hein Doof} & \texttt{27478 Cuxhaven}
      \end{tabular}
    \item<3->
      Product search:\\[0.5em]
      \texttt{memory stik}
    \item<4->
      Websearch:\\[0.5em]
      \texttt{eyjaf\"ollajak\"ull}\\
      \texttt{uniwersit\"at verien 2017}
    \item<5->
      Bioinformatics: Similarity of DNA-sequences
  \end{itemize}
\end{frame}

%-------------------------------------------------------------------------------

\begin{frame}{Introduction}{Example: Bioinformtics DNA-matching}
  \textbf{Search of similar proteins:}
  \begin{itemize}
    \item<2->
      \texttt{BLAST} (\textbf{B}asic \textbf{L}ocal \textbf{A}lignment
        \textbf{S}earch \textbf{T}ool)
    \item<3->
      Alignment $\hat{=}$ Edit distance
    \item<4->
      Changed life-science completely
    \item<5->
      Cited 63437 times on Google Scholar (Sep. 2017)

  \end{itemize}

\end{frame}


%% SECTION HEADER /////////////////////////////////////////////////////////////////////////////////////
\section{Model-assisted severity damage assessment }
\label{sec:madif}

%% SECTION CONTENT ////////////////////////////////////////////////////////////////////////////////////

%% SUBSECTION HEADER //////////////////////////////////////////////////////////////////////////////////
The process of determining the damage size is shown in the flowchart in Fig. \ref{fig:Flowchart}.
Before inspecting a given \ac{hsc} panel, a numerical analysis is performed to determine a function that describes the effect of damage on wave propagation.
Then the model is subjected to experimental validation.
If the simulation results do not agree with the measured results, the material parameters of the components should be adjusted.
In the dissertation, the volume fraction fibre of the \ac{cfrp} is adjusted to determine a wave velocity \cite{kudela2007modelling} and a damping coefficient of the skin to set the magnitude of the registered signals \cite{wandowski2017guided}.
\begin{figure}[H]
		\begin{center}
	\includegraphics[width=1\linewidth]{Chapter_3/flowchart}
		\end{center}
	\caption{A flowchart representing the process for damage size estimation.}
	\label{fig:Flowchart}
\end{figure}

When the structure model is developed, several computer simulations for various damage sizes must be conducted to determine the \ac{madif}, a cornerstone of the dissertation. This function determines the severity of the \ac{hsc} damage based on the signal received by the sensor.
Several excitation signals and damage indices will be considered to select the best \ac{madif}.
The selection criterion will be the monotonicity and the function slope over the considered range of the damage size. Then, the damage magnitude is obtained from the \ac{madif} for the measured signal and normalised to the reference one.