\section{Simulation of fragment evaporation.}

\hspace{1.0em} The evaporation of
 neutron, proton, deutron, thritium and alpha fragments
 are taken into account.

\subsection{Evaporation threshold.}

\hspace{1.0em}One should take into account the energy condition
for fragment emission, i. e. the nucleus
excitation energy should be higher than
the reaction threshold:
\begin{equation}
\label{SFE1}T_b^{\max }=E^{*}-Q_b-V_b > 0.
\end{equation}
Here $T_b^{\max }$ is the maximal kinetic energy carried by emitted
fragment $b$, $Q_b = M(A,Z)-M(A_f,Z_f)-M_b$ is the fragment $b$ binding
energy. $V_b$ is the Coulomb
potential energy, i. e. the Coulomb barrier for fragment $b$.
 $M(A,Z)$ is the mass of the initial nucleus, $M(A_f,Z_f)$ is
the mass of the nucleus after emission of fragment $b$ and $M_b$ is the
fragment $b$ mass. It should be noted that expression ($\ref{SFE1}$) is
only valid, when the recoil kinetic energy equals zero. In our code we
apply the condition:
\begin{equation}
\label{SFE2}T_b^{\max }=E_b^{\max}-M_b-V_b > 0,
\end{equation}
where
\begin{equation}
\label{SFE3}E_b^{\max }=\frac{(M(A,Z)+E^{*})^2+M^2_b-M^2(A_f,Z_f)}
{2(M(A,Z)+E^{*})}.
\end{equation}

\subsection{Nuclear and fragment mass defects.}

\hspace{1.0em}We use neither the tabulated \cite{AW95} or
 calculated according to
the  Cameron's liquid drop model formula \cite{CAM57} values of
mass defects $dM(A,Z)$, $dM(A_f,Z_f)$ and $dM_b$, respectively
%
\begin{equation}
\label{SFE4}
\begin{array}{c}
dM(A,Z)=M_{Volume}(A,Z)+M_{Surface}(A,Z)+M_{Coulomb}(A,Z)+ \\
+M_{Exchange}(A,Z)+\Delta^{C}_{Shell}(A,Z)+\Delta^{C}_{Pair}(A,Z)+ \\
+(A - Z)m_N + Zm_H,
\end{array}
\end{equation}
where
\begin{equation}
\label{SFE5}M_{Volume}(A,Z)=-17.035[1-1.846(\frac{A-2Z}A)^2]A
\end{equation}
is the volume energy;
\begin{equation}
\label{SFE6}M_{Surface}(A,Z)=25.8357[1-1.712(\frac{A-2Z}A)^2]
[1-\frac{0.62025}{A^{2/3}}]^2A^{2/3}
\end{equation}
is the surface energy;
\begin{equation}
\label{SFE7}M_{Coulomb}(A,Z)=0.779\frac{Z(Z-1)}{A^{1/3}}[1-\frac{1.5849
}{A^{2/3}}+\frac{1.2273}A+\frac{1.5772}{A^{4/3}}
\end{equation}
is the Coulomb energy;
%
\begin{equation}
\label{SFE8}M_{Exchange}(A,Z)=-0.4323\frac{Z^{4/3}}{A^{1/3}}[1-\frac{%
0.57811}{A^{1/3}}-\frac{0.14518}{A^{2/3}}+\frac{0.49597}A
\end{equation}
is the exchange energy and $m_N=8.07169$ MeV and $m_H= 7.8922$ MeV are
the mass excess of neutron and the hydrogen atom, respectively. The
values of $\Delta^{C}(A,Z)=\Delta^{C}_{Shell}(A,Z)+\Delta^{C}_{Pair}(A,Z)$
is connected with
influences of shell structure and pairing effect and their values are
tabulated.

\subsection{Coulomb barrier calculation.}

\hspace{1.0em}The  Coulomb barrier:
\begin{equation}
\label{SFE9}V_b = C_b\frac{Z_bZ_f}{R_f+R_b},
\end{equation}
where $C_b = 1.44$ \ MeVfm, $Z_b$ and $R_b$ are charge and
 radius of nucleus after fragment
emission, $Z_f$ and $R_f$ are charge and radius of fragment. The value
$V_b$  varies with the excitation energy $E^{*}$,
  as $1/(1+\sqrt{\frac{E^{*}}{2A}})$ \cite{Charity88}.
The radii of nuclei are
approximated by $R = r_{C}A^{1/3}$,
 where \cite{IKP94}
\begin{equation}
\label{SFE8}r_{C} = 2.173\frac{1+0.006103Z_bZ_f}{1+0.009443Z_bZ_f} \ fm.
\end{equation}

\subsection{The fragment evaporation probability.}

\hspace{1.0em}Evaporation process has been  predicted by the statistical
Weisskopf-Ewing model \cite{WE40}.  Probability to evaporate particle
$b$ in the energy interval $(T_b, T_b+dT_b)$ per unit of time is given
\begin{equation}
\label{SFE9}W_{b}(T_b) = \sigma_{b}(T_b)\frac{(2s_b+1)m_b}{\pi^2 h^3}
\frac{\rho_b(U_b - Q_b-T_b)}{\rho_c(U_c)}T_b,
\end{equation}
where $\sigma_{b}(T_b)$ is the inverse (absorption of particle $b$)
reaction cross section, $s_b$ and $m_b$ are particle spin and mass,
  $\rho_c$ and $\rho_b$ are level densities of compound nucleus  and
nucleus after particle evaporation, respectively.
The energies $U_b$ and $U_c$ are defined as $U_b = E^{*} - \Delta_b$
and $U_c = E^{*} - \Delta_c$, where $\Delta_{b,c}$ are pairing energies
$\Delta_{Pair}$
of the compound and residual nuclei, respectively.
The pairing energy $\Delta_{Pair}$ is calculated according to
\begin{equation}
\label{SFE10} \Delta_{Pair} = \kappa \frac{12}{\sqrt{A}} \ [MeV]
\end{equation}
with $\kappa = 0$, $1$, or $2$ for odd-odd, odd-even or even-even
nuclei, respectively.

We should note, that Eq. ($\ref{SFE9}$) is written for the case,
when we have neglected angular momenta and parities
of the compound and residual nuclei as well as the spin
of the evaporated fragment.

\subsection{The inverse reaction cross section.}

\hspace{1.0em}To calculate inverse   reaction cross section it is
assumed to have the form \cite{Dostr59}
\begin{equation}
\label{SFE11}
\sigma _b(T_b ) = (1+C_b)(1-k_bV_b/T_b )\pi R^2
\end{equation}
for charged charged fragments with $A_f \leq 4$ interaction, where the
$k_b$ is the barrier penetration coefficient ( its tabulated values are
used), and
\begin{equation}
\label{SFE12}
\sigma _b(T_b ) = \alpha (1 + \beta /T_b )\pi R^2
\end{equation}
for neutrons. Here $R = r_{0} A^{1/3}$ denotes the absorption radius, where
$r_0 = 1.5$ \ fm,
$\alpha =0.76 + 2.2 A^{-1/3}$ and $\beta=(2.12 A^{-2/3} - 0.05)/(0.76 +
2.2 A^{-1/3})$.

\subsection{The level density.}

\hspace{1.0em}The level
density is approximated by Fermi-gas approach \cite{IKP94} for the nuclear
level density:
\begin{equation}
\label{SFE13} \rho(E^{*}) = C\exp{(2\sqrt{aE^{*}})},
\end{equation}
where $C$ is a constant, which does not depend from nucleus properties
and excitation energy $E^{*}$ and $a$ is the level density parameter (note,
the system entropy is defined as $S=2\sqrt{aU}$).

\subsection{Level density parameter calculation.}

\hspace{1.0em}This parameter plays a major role in level density models.
The parametrization $a=A/k$ MeV$^{-1}$, where $k\approx 8$,
approximation ( this approximation is used), which is frequently
employed in equilibrium calculations, is not adequate in the
neighborhood of magic nuclei.  Instead, marked shell effects appear for
these nuclei and these effects manifest themselves by an associated
decrease of the level density parameter at the binding energy. It has
been argued by Ignatyuk  \cite{Ignat75} that these shell
effects disappear with increasing excitation energy so that at
sufficiently high excitation energy a simple linear mass dependence of
the level density parameter is recovered. In our calculations we use
the Iljinov's systematics for $a(Z,A,E^{*})$ \cite{Iljinov92}.
The authors of \cite{Iljinov92} used a functional form proposed
by Ignatyuk  \cite{Ignat75}:
\begin{equation}
\label{SFE14}a(Z,A,E^{*}) = a_0(A)[1+
\Delta^{C}_{Shell}(Z,A)\frac{f(E^{*}-\Delta_{Pair})}
{E^{*}-\Delta_{Pair}}],
\end{equation}
where
\begin{equation}
\label{SFE15}a_0(A)=\alpha A + \beta A^{2/3}B_s
\end{equation}
is the Fermi-gas value of the level density parameter at high excitation
energies and
\begin{equation}
\label{SFE16} f(U) = 1 - \exp{(-\gamma E^{*})}.
\end{equation}
 $B_s$ is the ratio of the surface are of the nucleus to the
surface are of the sphere of the same volume. It was taken $B_s = 1$.
$\Delta_{Shell}(Z,A)$ is
the shell correction in the nuclear mass formula \cite{CAM57}.
The parameters $\alpha = 0.072$, $\beta = 0.257$ and $\gamma = 0.052$
\ MeV$^{-1}$ were found in \cite{Iljinov92}.

\subsection{The total evaporation probability.}

\hspace{1.0em}The total probability $W_b$ or total partial width
$\Gamma_b=\hbar W_b$ to evaporate particle $b$ can be obtained from
Eq. ($\ref{SFE9}$) by integration over $T_b$:
\begin{equation}
\label{SFE17}
W_{b}=\int_{V_b}^{U-Q_b} W_b(T_b)dT_b.
\end{equation}
Here the summation is carried out over all excited states of the
fragment.

Integration in Eq. ($\ref{SFE17}$) for probability to emit fragment $b$
can be performed analiticaly, if we will use Eq. ($\ref{SFE11}$) for level
density and the Eqs. ($\ref{SFE11}$)-($\ref{SFE12}$) for inverse cross
section.
The probability
to emit a charged particle:
\begin{equation}
\label{SFE18}
\begin{array}{c}
W_{b}=\gamma _bA_b^{2/3}B\exp [-2
\sqrt{aU}]\frac{(1+C_b)}{a_b^2}\{a_bT_b^{\max }[2\exp (2\sqrt{%
a_bT_b^{\max }})+1]- \\
- 3\sqrt{a_bT_b^{\max }}\exp (2\sqrt{a_bT_b^{\max }}%
)-3[1-\exp (2\sqrt{a_bT_b^{\max }})]/2\},
\end{array}
\end{equation}
where $T_b^{max}$ is defined by the equation ($\ref{SFE1}$).
The following notations were introduced: $A_b=A-\Delta A_b$, $%
B=m_Nr_0^2/(2\pi h^2)$, $\gamma _b=(2s_b+1)m_b/m_N$. $\Delta A_b$ is the
number of nucleons in $b$ particle. $m_b$, $m_N$ and $s_b$ are mass of
particle $b$, mass of nucleon and spin of particle $b$ respectively.
  The $a_b$ is level density parameter for
nucleus after emission of fragment $b$.
Similarly for the neutron evaporation probability we obtain the
following equation:
\begin{equation}
\begin{array}{c}
\label{SFE19}W_{n}
=\gamma _nA_n^{2/3}B\frac \alpha {2a_n^2} \\
\exp [-2\sqrt{aE^{*}}+2\sqrt{a_nT_n^{\max }}]
[4a_nT_n^{\max }+(2a_n\beta -3)(2\exp (2\sqrt{a_nT_n^{\max }}-1)].
\end{array}
\end{equation}
Using probabilities Eq. ($\ref{SFE18}$) and Eq. ($\ref{SFE19}$) we are
able to
choose randomly the type of emitted fragment.

\subsection{Kinetic energy of emitted fragment.}

\hspace{1.0em}The equation ($\ref{SFE9}$) can be used to sample kinetic
energies of evaporated fragments.
 For example, keeping terms in Eq. ($\ref{SFE9}$),
which depend from $T_b$ and using the approximations for inverse cross
section is given by Eq. ($\ref{SFE11}$) and for level densities are given
by Eq. ($\ref{SFE13}$), we obtain for charged fragments
\begin{equation}
\label{SFE20}W(x)=C_1 x\exp (2\sqrt{a(T_b^{\max }-x)}= C_2
T_b\exp (2\sqrt{aE^{*}}),
\end{equation}
where $C_1$ and $C_2$ do not depend from $T_b$, $x=T_b-V_b$. To generate
values of $x$ we can use the next procedure, changing the expression for
$W(x)$ to have $W(x^{\max })=1$ ($x^{\max }=[(a_b+T_b^{\max
}+1/4)^{1/2}-1/2]/a_b$). Choose two random numbers $\xi _1$ and $\xi _2$
(distributed with equal probabilities between 0 and 1) and find kinetic
energy of particle $b$ as $T_b=T_b^{\max }\xi _1+V_b$ at condition $\xi
_2\leq W(\xi _1T_b^{\max })$. If this condition is not fulfilled we
should choose another pair of random numbers.

\subsection{Angular distribution of evaporated fragments.}

\hspace{1.0em}So far we consider the angular distribution for emitted
fragments as
isotropical in spite of that decaing nucleus has an angular momentum.

\subsection{The angular momenta of
evaporated fragments.}
\hspace{1.0em} The angular momenta of and evaporated particles
are considered as classical vectors ${\bf l_i}$ and estimated in the sharp
cut-off approximation \cite{IT69}, \cite{IT73} according to
\begin{equation}
\label{SF21}P(l_b)dl_b \sim l_bdm_b, 0 \leq l_b \leq l_b^{max}
\end{equation}
where
\begin{equation}
\label{SF22} l_b^{max}=\sqrt{2\mu_b(E_b - V_b)}R_b/\hbar.
\end{equation}
Here $R_b$ is the radius of the interaction of the $b$th
emmitted particle with the
residual nucleus, $E_b$,$V_b$ and $\mu_b$ are the energy
in the center-of-mass system,
Coulomb barrier and reduced mass of particle, respectively.
The spins of the emmitted
particles are not taken into account when estimating the
angular momentum of the
residual nuclei.
Angular momenta of residual nuclei are calculated
without taking into
account the spin of initial target nucleus and of
intermediate nuclei during emission
of particles.

\subsection{Parameters of residual nucleus.}

\hspace{1.0em}After fragment emission we  update parameter
of decaying nucleus:
\begin{equation}
\label{SFE21}
\begin{array}{c}
A_f=A-A_b; Z_f=Z-Z_b; P_f = P_0 - p_b; \\
E_f^{*}=\sqrt{E_f^2-\vec{P}^2_f} - M(A_f,Z_f); \vec{L}_f = \vec{L}_0-\vec{l_b}.
\end{array}
\end{equation}
Here $p_b$ is the evaporated fragment four momentum.
Angular momenta of residual nuclei are calculated without taking into
account the spin of initial target nucleus and
 of intermediate nuclei during emission
of fragments.

\subsection{The angular momentum of excited nuclei.}

\hspace{1.0em}The angular momentum influence on evaporation and
fission processes can be approximately taken into account.
Thus the angular momentum $L$
dependence of the level density can be approximated \cite{ICC80}
by
\begin{equation}
\label{SFE22}\rho(U-\Delta_{Pair},L)=\rho(E^{*},0),
\end{equation}
 where $E^{*}=U-\Delta_{Pair}-E_R$
 and $E_R$ are
the thermal and rotational energies of the nucleus, respectively.
The fission barrier $B_{fis}(L)$ for a fissioning nucleus with the angular
momentum $L$ can be approximated as
\begin{equation}
\label{SFE23} B_{fis}(L)=B_{fis}(0) - (E^{GS}_{R} - E^{SP}_R),
\end{equation}
where $E^{GS}_{R}$ and $E^{SP}_R$ are nuclear rotational energies for
the ground state and at the saddle-point, respectively.
The rotational energies is calculated according to
\begin{equation}
\label{SFE24} E_R=\frac{L(L+1)}{2\theta},
\end{equation}
where $\theta$ is the moment inertia of a nucleus. The moment of inertia for the
compound and residual nucleus are calculated according to a rigid-body
expression:
\begin{equation}
\label{SFE25} \theta=0.4m_Nr^2_0A^{5/3},
\end{equation}
where $m_N$ is nucleon mass and $r_0 = 1.2$ \ fm.
The moment inertia of a nucleus at saddle-point $J_{SP}$ is calculated in
 in \cite{CS63}.


\section{End-to-end dog reconstruction from monocular images}

This section describes a technique for reconstructing a 3D dog mesh from a single, monocular image. This is achieved using an end-to-end convolutional neural network, which predicts pose $\pose$ and shape-scale $\shapescale$ for the SMBLD morphable dog model, translation and orientation $\posn$ and focal length $f$ for a perspective camera $\proj_{f}$. A complete overview of the proposed system is shown in Figure~\ref{fig:sys_overview_train_sup}.

% the model's 3D {\em position} (i.e.\ translation and orientation) is also unknown, and will be represented by a parametrization $\posn$ which may be for example translation as a 3-vector and rotation in axis angle form. Application of such a transformation to a $3\times\nverts$ matrix will be denoted by $*$, so that
% \begin{equation}
% \posn * \verts(\pose, \shape)
% \end{equation}

\subsection{Model architecture}

%extended with convolutional layer and an fully-connected layer
The network architecture for WLDO is inspired by the model of 3D-Safari~\cite{Zuffi19Safari}. Given an input image cropped to (224, 224), a Resnet-50~\cite{he2016deep} backbone network is applied in order to encode a 1024-dimensional feature map. These features are passed through various linear prediction heads to produce the required parameters. The pose, translation and camera prediction modules follow the design of 3D-Safari, but we describe the differences in our shape-scale module.

\ss{Pose, translation and camera prediction.}
These modules are independent multi-layer perceptrons which map the above features to the various parameter types. As with 3D-Safari, two linear layers are used to map to a set of $35 \times 3$ 3D pose parameters (three parameters for each joint in the SMBLD kinematic tree and three parameters for the model orientation) given in Rodrigues form. The translation component of the SMBLD model is predicted with two linear layers that predict translation in the camera frame $\trans_{x,y}$ and depth $\trans_{z}$ independently. The camera prediction layer predicts the focal length of the perspective camera. Note that while this parameter is theoretically unnecessary since model depth is already predicted, as in the original 3D-Safari implementation, including the parameter produces empirally better fits. The camera focal length is obtained as $f = f_{0} + f_{1}x$ where $x$ is predicted by the network and $f_{0} = f_{1} = 2700$.

\ss{Shape and scale prediction.}

Unlike 3D-Safari, WLDO predicts a set of shape and scale parameters rather than vertex offsets. Separate predictions heads are used to predict 20 shape parameters $\shape$ and the new scale parameters $\kappa$. The scale parameters are obtained as $\scale = \exp{x}$ where $x$ are the network predictions, as predicting log scale helps stabilise early training and conveniently guarantees non-negative values for scale.

\subsection{Training losses}

A typical approach for training such an end-to-end system would be to supervise the prediction of $(\pose, \shapescale, \posn, \f)$ with 3D ground truth annotations~\cite{kolotouros19learning,kanazawa18end-to-end,pavlakos18learning}. However, building a suitable 3D annotation dataset would require an experienced graphics artist to design an accurate ground truth mesh for each of 20,520 StanfordExtra dog images, a prohibitive expense.

Instead, WLDO relies on \emph{weak 2D supervision} provided by 2D keypoints and silhouette segmentations to guide network training. These data sources are significantly cheaper to obtain than 3D models.

The remainder of this section describes the set of losses used to supervise the network at train time.

\ss{Joint reprojection.}
As in \Cref{chap:cgas}, the joint projection loss $\L{joints}$ promotes accurate limb positioning by comparing the projected model joints to the ground truth annotations $X^{*}$. To achieve this, the SMBLD generator function processes the network's pose $\pose$ and shape-scale $\shapescale$ parameters to generate a set of 3D joint positions which are translated and orientated with $\posn$. The joint positions are then projected to the image plane using the camera parameters. The joint loss $\L{joints}$ is given by the $\ell_2$ error between the ground truth and projected joints:

\begin{equation}
\L{joints}(\pose, \shapescale, \posn, \f; X^{*}) = \lVert X^{*} - \proj_{f}(\posn * \verts(\pose, \shapescale) \jointselect) \rVert_{2}
\end{equation}

Note that many of the training images contain significant occlusion, so $X^{*}$ contains many invisible joints. This is handled by masking $\L{joints}$ so that invisible joints do not contributing to the loss.

\ss{Silhouette loss.}
The silhouette loss $\L{sil}$ is used to promote shape alignment between the SMBLD dog mesh and the input dog. In order to compute the silhouette loss, a rendering function $R\bigl(\posn * \verts(\pose, \shapescale)\bigr) \in \mathbb{B}^{W\times H}$ projects the SMBLD mesh to produce a binary segmentation mask. In order to allow derivatives to be propagated, $R$ is implemented using the differentiable Neural Mesh Renderer~\cite{kato2018renderer}. The loss is computed as the $\ell_2$ difference between a projected silhouette and the ground truth mask $S$:

\begin{equation}
\L{sil}(\pose, \shapescale, \posn, \f; S) = \lVert S - R\bigl(\posn * \verts(\pose, \shapescale)\bigr) \rVert_{2}
\end{equation}

% The model is also assumed to be supplied with a rendering function $R$ which takes a vertex array in camera coordinates, and generates a 2D binary image of the model silhouette.  That is,
% \begin{equation} \label{eq:render_sil}
% R\bigl(\posn * \verts(\pose, \shape)\bigr) \in \mathbb{B}^{W\times H}
% \end{equation}
% for an image resolution of $W \times H$.

\ss{Pose prior.}
In the absence of 3D ground truth training data, priors are obtained from artist graphics models in order to encourage realism in the network predictions. The pose prior is modelled as a multivariate Gaussian prior consisting of mean $\mu_{\pose}$ and a covariance matrix $\Sigma_{\pose}$. The loss is given as the log likelihood of a given shape or pose vector under these distributions, which corresponds to the Mahalanobis distance between the predicted parameters and their corresponding means:
\begin{align}
    \L{pose}(\pose; \mu_{\pose}, \Sigma_{\pose}) &= (\pose - \mu_{\pose})^T \Sigma_{\pose}^{-1} (\pose - \mu_{\pose})\\
\end{align}
Unlike previous work, there is no need to use a loss for penalizing pose parameters if they exceed manually specified joint angle limits. It is suspected that that the WLDo network learns this regularization naturally by training on the large dataset.

\ss{Shape-scale prior.}
As discussed in the previous section, the shape prior is modelled as a mixture of $M$ Gaussians.
Recall that $\shapescalemu^{m}$, $\shapescalecov^{m}$ and $\shapescalepi^{m}$ are the mean, covariance and mixture weight respectively for each Gaussian component
$m$. From before, the mixture shape loss is given as:
\begin{align}
    \L{mixture}(\shapescale_{i}; \shapescalemu, \shapescalecov, \shapescalepi)
    =&
    \sum_{m=1}^M \shapepi^{m} \left[\L{shape-scale}(\shapescale_{i}; \shapescalemu^{m}, \shapescalecov^{m})\right]
\end{align}


\section{Shelley Prerequisites}\label{shelley}

\subsection{Assumptions}
\paragraph{Number of active users $u$.}
We assume that $u$ represents the number of users \emph{actively} participating in the software updates protocol. An active user is a user that is on-line and generates protocol events, such as:
\begin{itemize}
\item submits SIPs
\item votes for SIPs
\item submits UPs
\item votes for UPs
\item signals upgrade readiness
\end{itemize}

\subsection{Event Submission Time $est(u)$}
All events (proposal submission, votes etc.) generated by the software update protocol are essentially embedded within common transactions and transmitted to the network before being committed into the blockchain. Therefore, for all of our time measurements, we need to be able to calculate the time for the submission of a transaction into the blockchain network.

In particular, we define a function $\textbf{est(u)}$, which returns the \emph{Event Submission Time}, when a specific number of $u$ users participate in the protocol (i.e., \emph{active} users). The $est$ comprises the following steps in the life of a transaction:
\begin{itemize}
\item The transaction $T_x$ that embeds a software update protocol event, is created by the user and transmitted to the network.
\item $T_x$ is selected from the mempool and included into a block by a slot leader (i.e., miner). This block is then transmitted to the network.
\item Stabilization period. This is the required time period, in order for the new block to be stably committed into the blockchain. This period is a function of the security parameter $k$. We assume the existence of a function $stable(k)$ that returns this period (see next).
\end{itemize}

The $est(u)$ function might \emph{not} be a pure function. Meaning that for a specific number of users might not return a fixed time. The result however must correspond to a network of $u$ active users.

\subsection{Signal Submission Time $sst(u)$}
We define a function $\textbf{sst(u)}$, which returns the \emph{Signal Submission Time}, when a specific number of $u$ users participate in the protocol (i.e., \emph{active} users). The $sst$ comprises the following steps:
\begin{itemize}
\item A slot leader creates a new block and marks it with the new version (after the upgrade) and transmits it to the network.
\item Stabilization period. This is the required time period, in order for the new block to be stably committed into the blockchain. This period is a function of the security parameter $k$. We assume the existence of a function $stable(k)$ that returns this period (see next).
\end{itemize}

The $sst(u)$ function might \emph{not} be a pure function. Meaning that for a specific number of users might not return a fixed time. The result however must correspond to a network of $u$ active users.

\subsection{Stabilization Period $stable(k)$}
Stabilization period. This is the required time period, in order for a new block to be stably committed into the blockchain. This period is a function of the security parameter $k$. We assume the existence of a function $\textbf{stable(k)}$ that returns this period.


\section{UTxO}
\label{sec:utxo}

\subsection*{UTxO Helper Functions}

\begin{figure}[htb]
  \emph{Type Definition}
  \begin{equation*}
    \begin{array}{r@{~\in~}l@{\qquad=\qquad}lr}
      \var{mest} & \MemoryEstimate & \N
    \end{array}
  \end{equation*}
  %
  \emph{Abstract Helper Function}
  \begin{align*}
    \fun{utxoEntrySize} \in& ~\TxOut \to \MemoryEstimate & \text{Memory estimate for}~\TxOut
  \end{align*}
  %
  \emph{Helper Functions}
  \begin{align*}
    & \fun{ininterval} \in \Slot \to (\Slot^? \times \Slot^?) \to \Bool \\
    & \fun{ininterval}~\var{slot}~(i_s, i_f) ~=~
    \begin{cases}
      \True & (i_s = \Nothing)~\wedge~(i_f = \Nothing) \\
      \var{slot}~<~i_f & (i_s = \Nothing)~\wedge~(i_f \neq \Nothing)\\
      i_s~\leq~\var{slot} & (i_s \neq \Nothing)~\wedge~(i_f = \Nothing) \\
      i_s~\leq~\var{slot}~<~i_f & (i_s \neq \Nothing)~\wedge~(i_f \neq \Nothing)
    \end{cases}
    \nextdef
    & \fun{getCoin} \in \TxOut \to \Coin \\
    & \fun{getCoin}~{(\wcard,~\var{out})} ~=~\fun{coin}~\var{out}
    \nextdef
    & \fun{ubalance} \in \UTxO \to \hldiff{\Value} \\
    & \fun{ubalance} ~ utxo = \hldiff{\sum_{\wcard\mapsto\var{u}\in~\var{utxo}} \fun{getValue}~\var{u}}
  \end{align*}
  %
  \emph{Produced and Consumed Calculations}
  \begin{align*}
    & \fun{consumed} \in \PParams \to \UTxO \to \TxBody \to \hldiff{\Value} \\
    & \consumed{pp}{utxo}{txb} = \\
    & ~~\ubalance{(\txins{txb} \restrictdom \var{utxo})} ~+~ \hldiff{\fun{mint}~\var{txb}} \\
    &~~+~\hldiff{\fun{inject}}(\fun{wbalance}~(\fun{txwdrls}~{txb})~+~ \keyRefunds{pp}{txb})
    \nextdef
    & \fun{produced} \in \PParams \to \StakePools \to \TxBody \to \hldiff{\Value} \\
    & \fun{produced}~\var{pp}~\var{stpools}~\var{txb} = \\
    &~~\ubalance{(\fun{outs}~{txb})} \\
    &~~+ \hldiff{\fun{inject}}(\txfee{txb} + \totalDeposits{pp}{stpools}{(\txcerts{txb})})
  \end{align*}
  \caption{UTxO Calculations}
  \label{fig:functions:utxo}
\end{figure}

Figure~\ref{fig:functions:utxo} defines additional calculations that are needed for the
UTxO transition system with multi-assets:

\begin{itemize}
  \item The $\MemoryEstimate$ type represents the size, in \emph{words} (8 bytes), of
  a term (eg. a transaction input, or output). Note that this estimate is calculated
  according to fomulas we provide in this specification (see Appendix \ref{sec:value-size}),
  as opposed to obtained using an existing function of the programming
  language selected for implementation.

  \item The $\fun{utxoEntrySize}$ function provides a rough estimate of
    the amount of memory the storage of an output will consume, which is used in the UTXO rule.
    Its implementation is described in Appendix \ref{sec:value-size}.

  \item The function $\fun{ininterval}$ returns $\True$ whenever the given slot is
  inside the given interval. If an endpoint of the validity interval
  is $\Nothing$, the comparison of the slot to that endpoint is $\True$ by default.

  \item The function $\fun{getCoin}$ returns the Ada in a given output as a $\Coin$ value.

  \item The $\fun{ubalance}$ function calculates the sum total in a given UTxO.

  \item The $\fun{consumed}$ and $\fun{produced}$ calculations are similar to their Shelley
    counterparts, with the following changes: 1) They return elements of $\Value$, which
    the administrative fields of type $\Coin$ have to be converted to, via $\fun{inject}$.
    2) $\fun{consumed}$ also contains the $\fun{mint}$ field of the transaction.
    This is explained below.
\end{itemize}

\subsection*{Minting and the Preservation of Value}
What does it mean to preserve the value of non-Ada tokens, since they
are put in and taken out of circulation by the users themselves?

For the following discussion, we focus on a single arbitrary
$\var{pid}$ that is not $\mathsf{adaPolicy}$. If a transaction $\var{tx}$
does not mint any tokens with policy ID $\var{pid}$, the preservation
of value reduces to an equation that the sum of inputs and the sum of
outputs are equal, which is exactly the same condition as for Shelley,
except that there are no administrative fields. If a transactions
mints tokens of that policy ID, then the sum of inputs and the sum of
outputs will differ, and that difference has to be exactly the value
of the $\fun{mint}$ field. Note that this means that the
$\fun{mint}$ field can also contain negative quantities.

To balance the preservation of value equation, the $\fun{mint}$ field
could be included in either $\fun{consumed}$ or $\fun{produced}$, with
the only difference being the sign of the $\fun{mint}$ field. We
include it on the $\fun{consumed}$ side, because this means that
minting a positive quantity increases the amount of tokens on the
ledger, and minting a negative quantity reduces the amount of tokens on
the ledger.

Note that the UTXO rule specifically forbids the minting of Ada, and
thus in the case of Ada, the preservation of value equation is exactly
the same as in Shelley.

The minting scripts themselves are not evaluated at part of the UTXO, but instead
as part of witnessing, i.e. in the UTXOW rule, see Figure~\ref{fig:functions-witnesses}.

\subsection*{The UTXO Transition Rule}
In Figure \ref{fig:rules:utxo-shelley}, we give the UTXO transition rule,
updated for multi-asset support. There are the following changes to the preconditions
of this rule as compared to the original Shelley UTXO rule:

\begin{itemize}
  \item The check that the time-to-live of a transaction is after the current
  slot is replaced with the check that the current slot is inside the validity interval

  \item In the preservation of value calculation (which looks the same as in
  Shelley), the value in the $\fun{mint}$ field is taken into account.

  \item The transaction is not minting any Ada.

  \item The $\Value$ in each output is constrained from below by a
    $\Value$ that contains some amount of ada and no other tokens.
    The amount of ada that is contained in the constraint $\Value$ (and
    hence the $\Value$ in the output itself must contain at least as much) depends on the
    size of the output. To get the minimum ada amount, the size of the output is multiplied by
    the function $\var{adaPerUTxOWord}$ applied to protocol parameters
    (see Section~\ref{sec:value-size} for the function definition).
    Note that this check implies that no quantity of any token appearing in that output can be
    negative.

    \item The serialized size of the $\Value$ in each output is no greater than $\mathsf{MaxValSize}$
    (specified in Section~\ref{sec:value-size}).
    This ensures that each individual output is never so large that any transaction carrying all the
    witness data (eg. large scripts, etc.) necessary for spending such an output will exceed the transaction size limit.
    See Section~\ref{sec:value-size} for details.
\end{itemize}

Note that updating the $\UTxO$ with the inputs and the outputs of the transaction
looks the same as in the Shelley rule. There is a type-level difference however, as
the outputs of a transaction contain a $\Value$ term, rather than
$\Coin$.

\begin{figure}[htb]
  \begin{equation}\label{eq:utxo-inductive-shelley}
    \inference[UTxO-inductive]
    { \var{txb}\leteq\txbody{tx}
      & \hldiff{\fun{ininterval}~\var{slot}~(\fun{txvld}{tx})}
      \\ \txins{txb} \neq \emptyset
      & \minfee{pp}{tx} \leq \txfee{txb}
      & \txins{txb} \subseteq \dom \var{utxo}
      \\
      \consumed{pp}{utxo}~{txb} = \produced{pp}{stpools}~{txb}
      \\
      ~
      \\
      {
        \begin{array}{r}
          \var{slot} \\
          \var{pp} \\
          \var{genDelegs} \\
        \end{array}
      }
      \vdash \var{pup} \trans{\hyperref[fig:rules:update]{ppup}}{\fun{txup}~\var{tx}} \var{pup'}
      \\
      ~
      \\
      \hldiff{\mathsf{adaPolicy}~\notin \supp{\fun{mint}~txb}} \\
      ~\\
      \hldiff{\forall txout \in \txouts{txb},} \\
      \hldiff{\fun{getValue}~txout \geq} \\
      \hldiff{\fun{inject}~(\fun{max}~(\var{minUTxOValue}~pp,~\fun{utxoEntrySize}~{txout} * \fun{adaPerUTxOWord}~pp))} \\~
      \\
      \hldiff{\forall txout \in \txouts{txb},} \\
      \hldiff{\fun{serSize}~(\fun{getValue}~txout) ~\leq ~\mathsf{MaxValSize}} \\~\\
      \forall (\wcard\mapsto (a,~\wcard)) \in \txouts{txb}, a \in \AddrBS \Rightarrow \fun{bootstrapAttrsSize}~a \leq 64
      \\
      \forall (\wcard\mapsto (a,~\wcard)) \in \txouts{txb}, \fun{netId}~a =\NetworkId
      \\
      \forall (a\mapsto\wcard) \in \txwdrls{txb}, \fun{netId}~a =\NetworkId
      \\
      \fun{txsize}~{tx}\leq\fun{maxTxSize}~\var{pp}
      \\
      ~
      \\
      \var{refunded} \leteq \keyRefunds{pp}{txb}
      \\
      \var{depositChange} \leteq
        \totalDeposits{pp}{stpools}{(\txcerts{txb})} - \var{refunded}
    }
    {
      \begin{array}{r}
        \var{slot}\\
        \var{pp}\\
        \var{stpools}\\
        \var{genDelegs}\\
      \end{array}
      \vdash
      \left(
      \begin{array}{r}
        \var{utxo} \\
        \var{deposits} \\
        \var{fees} \\
        \var{pup}\\
      \end{array}
      \right)
      \trans{utxo}{tx}
      \left(
      \begin{array}{r}
        \varUpdate{(\txins{txb} \subtractdom \var{utxo}) \cup \fun{outs}~{txb}}  \\
        \varUpdate{\var{deposits} + \var{depositChange}} \\
        \varUpdate{\var{fees} + \txfee{txb}} \\
        \varUpdate{pup'}\\
      \end{array}
      \right)
    }
  \end{equation}
  \caption{UTxO inference rules}
  \label{fig:rules:utxo-shelley}
\end{figure}

\subsection*{Witnessing}

\begin{figure}[htb]
  \begin{align*}
    \fun{scriptsNeeded} & \in \UTxO \to \Tx \to \powerset{\ScriptHash} \hspace{2cm} \text{required script hashes} \\
    \fun{scriptsNeeded} &~\var{utxo}~\var{tx} = \\
    & ~~\{ \fun{validatorHash}~a \mid i \mapsto (a, \wcard) \in \var{utxo},\\
    & ~~~~~i\in\fun{txinsScript}~{(\fun{txins~\var{txb}})}~{utxo}\} \\
    \cup & ~~\{ \fun{stakeCred_{r}}~\var{a} \mid a \in \dom (\AddrRWDScr
           \restrictdom \fun{txwdrls}~\var{txb}) \} \\
      \cup & ~~(\AddrScr \cap \fun{certWitsNeeded}~{txb}) \\
      \cup & ~~\hldiff{\supp~(\fun{mint}~\var{txb})} \\
    & \where \\
    & ~~~~~~~ \var{txb}~=~\txbody{tx}
  \end{align*}
  \caption{Scripts Needed}
  \label{fig:functions-witnesses}
\end{figure}

Figure~\ref{fig:functions-witnesses} contains the changed definition
of the function $\fun{scriptsNeeded}$, which also collects the scripts
necessary for minting.

The witnessing rule UTXOW only needs a minor change for verifying the meta data hash,
which is replacing the condition $\var{md} = \Nothing$ with $\var{md} = (\emptyset, \Nothing)$.


\documentclass[main.tex]{subfiles}
\begin{document}

\section{Magneto-HydroDynamics}

\marginpar{Thursday\\ 2021-11-25}

We are going to briefly treat a topic which is often discussed in whole books.

The Vlasov equation has a large amount of information in it, way more than what we can actually measure for astrophysical plasmas.

So, we would like to treat our plasma like a magnetized fluid.
Further, we know that astrophysical plasmas are extremely conductive.
Therefore, the only significant electric field we can have is the one associated with induction.

Still, we must retain a kinetic description (with the full phase space distribution) for anything which is not the background plasma, like the nonthermal particles.
We only want to simplify the treatment of the background.

We always start with the Vlasov equation, which we can write in index notation:
%
\begin{align}
\pdv{f}{t} + \vec{v} \cdot \vec{\nabla} f
+ \frac{q}{m} \qty[\vec{E} + \frac{\vec{v}}{c} \times \vec{B}] \cdot \vec{\nabla}_v f &= 0  \\
\pdv{f}{t} + v_r \pdv{f}{x_r}
+ \frac{q}{m} \qty[E_r + \frac{1}{c} \epsilon_{rst} v_s B_t] \pdv{f}{v_r} &= 0
\,.
\end{align}

Now, we need to define local mean values with respect to the phase space distribution of any function:
%
\begin{align}
\expval{\varphi } = \frac{\int \dd[3]{v} \varphi f}{\int \dd[3]{v} f} = \frac{1}{n} \int \dd[3]{v} \varphi f
\,.
\end{align}

Suppose the function we are averaging is only dependent on the velocity, which we denote as \(\psi (\vec{v})\), we can multiply it by the Vlasov equation and integrate over \(\dd[3]{v}\): the various terms become
%
\begin{align}
\int \pdv{}{t} \psi (\vec{v}) f \dd[3]{v} &= \pdv{}{t} \int \dd[3]{v} \psi f = \pdv{}{t} \qty[n \expval{\psi }]  \\
\int \dd[3]{v} \psi (\vec{v}) v_r \pdv{f}{x_r} &= \pdv{}{x_r} \dd[3]{v} \psi v_r f = \pdv{}{x_r} \qty[n \expval{\psi v_r}]  \\
\frac{q}{m} \int \dd[3]{v} E_r \psi (\vec{v}) \pdv{f}{v_r} &= - \frac{q}{m} \int \dd[3]{v} f \dv{\psi }{v_r} E_r = - \frac{q}{m} E_r n \expval{ \dv{\psi }{v_r}}
\marginnote{We integrate by parts, and at the boundary \(\abs{v} \to \infty \) all quantities vanish.}  \\
\frac{q}{mc} \int \dd[3]{v} \psi \epsilon_{rst} v_s B_t \pdv{f}{v_r} &= - \frac{q}{mc} \int \dd[3]{v} f \epsilon_{rst} B_t \pdv{}{v_r} \qty( v_s \psi )  \\
&= - \frac{q}{mc} \epsilon_{rst} B_t n \expval{v_s \pdv{\psi }{v_r}}
\,.
\end{align}

We brought \(v_s\) outside the derivative since the term it yields is symmetric but contracted with the Levi-Civita symbol.

If we take \(\psi \equiv 1\), we get
%
\begin{align}
\dv{n}{t} + \pdv{}{x_r} \qty(n \expval{v_r})  = 0
\,,
\end{align}
%
since all the derivatives of \(\psi \) vanish.
We found the continuity equation!
Keep in mind that for now this only holds for one component of the fluid.

Let us take \(\psi = v_r\). We then get
%
\begin{align}
\pdv{}{t} \qty[n \expval{v_r}] +
\pdv{}{x_s} \qty[n \expval{v_r v_s}]
- \frac{q}{m} E_r n
- \frac{q}{mc} n \epsilon_{rst} B_t \expval{v_s} = 0
\,.
\end{align}

If the fluid is \emph{at rest} in our frame its mean velocity is zero.
Let us be more general than this: suppose there is a bulk motion \(u_r = \expval{v_r}\).
Then, the equation reads
%
\begin{align}
\pdv{}{t} \qty[n u_r] +
\pdv{}{x_s} \qty[n \expval{v_r v_s}]
- \frac{q}{m} E_r n
- \frac{q}{mc} n \epsilon_{rst} B_t u_s = 0
\,.
\end{align}

We have one of these equations for the electrons and one for the protons.
We have a few component masses in the denominator, but if we multiply through my \(m\) the densities in the first two terms just become mass densities.

Let us define the total density \(\rho = n_p m_p + n_e m_e\).
The density of charges will read \(\zeta = (n_p - n_e) e\),

For now, the bulk motions of electrons and protons may differ, so we will have \(u_{p, r}\) and \(u_{e, r}\).
The current density will then read
%
\begin{align}
J_r = \qty(n_p u_{p, r} - n_e u_{e, r}) e
\,.
\end{align}

We can define a global, mass-averaged bulk velocity:
%
\begin{align}
U_r = \frac{n_p m_p u_{p, r} + n_e m_e u_{e, r}}{\rho }
\,.
\end{align}

We still need to describe internal energy through fluctuations over this mean: the peculiar velocity will read
%
\begin{align}
w_{p, r} &= v_{p, r} - U_r \\
w_{e, r} &= v_{e, r} - U_r
\,.
\end{align}

Let us now multiply the continuity equation for protons by the proton mass, and similarly for the electrons:
%
\begin{align}
\pdv{}{t} (n_p m_p) + \pdv{}{x_r} \qty( n_p m_p u_{p, r}) &= 0  \\
\pdv{}{t} (n_e m_e) + \pdv{}{x_r} \qty( n_e m_e u_{e, r}) &= 0
\,,
\end{align}
%
which we can add together: we get a global mass conservation equation
%
\begin{align}
\pdv{\rho }{t} + \pdv{}{x_r} \qty(\rho U_r) = 0
\,.
\end{align}

Applying a similar procedure to the \(\psi = v_r\) equation we find
%
\begin{align}
\pdv{}{t} \qty(n_p m_p u_r) + \pdv{}{x_s} \qty(n_p m_p \expval{v_r v_s}) - e E_r n_p - \frac{e}{c} n_p \epsilon_{rst} B_t n_s &= 0
\,,
\end{align}
%
which we can add to the corresponding equation for the electrons.
First, though, let us look at the \(\expval{v_r v_s}\) term:
%
\begin{align}
\expval{v_r v_s}
&= \expval{(w_r + U_r) (w_s + U_s)}   \\
&= \expval{w_r w_s} + \expval{w_r} U_s + \expval{w_s} U_r + U_r U_s  \\
&=  \expval{w_r w_s} + (u_r - U_r) U_s + (u_s - U_s) U_r + U_r U_s   \\
&= \expval{w_r w_s} + u_r U_s + u_s U_r - U_r U_s
\,.
\end{align}

Let us now introduce a stress (pressure) tensor:
%
\begin{align}
P_{rs, p} = m_p \int \dd[3]{v} f w_{p, r} w_{p, s} = n m_p \expval{w_{p, r} w_{p_s}}
\,,
\end{align}
%
which yields
%
\begin{align}
\expval{v_r v_s} = \frac{P_{rs}}{mn} + u_r U_s + u_s U_r - U_r U_s
\,.
\end{align}

We can now sum the two components:
%
\begin{align}
\begin{split}
&\phantom{=}\
n_p m_p \qty[\frac{P_{rs, p}}{m_p n_p} + u_{r, p} U_s + u_{s, p} U_r - U_r U_s] +
n_e m_e \qty[\frac{P_{rs, e}}{m_e n_e} + u_{r, e} U_s + u_{s, e} U_r - U_r U_s] =\\
&= P_{rs} + \rho U_r U_s + \rho U_r U_s - \rho U_r U_s
= P_{rs} + \rho U_r U_s
\,.
\end{split}
\end{align}

The full equation now looks like:
%
\begin{align}
\dv{t}(\rho U_r) + \pdv{}{x_s} \qty[P_{rs} + \rho U_r U_s]
- \zeta E_r
- \frac{1}{c} \epsilon_{rst} J_s B_t = 0
\,.
\end{align}

We can expand the derivatives to get something which looks more like an equation of motion, and simplify through the continuity equation:
%
\begin{align}
\underbrace{\pdv{\rho }{t} U_r}_{U_r \times \text{continuity}} + \rho \dv{U_r}{t} + \pdv{P_{rs}}{x_s}
+ \underbrace{\pdv{}{x_s} \qty(\rho U_s) U_r}_{U_r \times \text{continuity}}
+ \pdv{}{x_s} \qty(\rho U_r) U_s + \dots
\,,
\end{align}
%
so the equation reads
%
\begin{align}
\underbrace{\rho \pdv{U_r}{t} + \rho U_s \pdv{U_r}{x_s} }_{\rho D_t U}
= - \pdv{P_{rs}}{x_s} + \zeta E_r
+ \frac{1}{c} \epsilon_{rst} J_s B_t
\,.
\end{align}

Now this system does not know about protons and electrons anymore: it is just a fluid.

In vector terms,
%
\begin{align}
\rho \qty[ \pdv{\vec{U}}{t} + \vec{U} \cdot \vec{\nabla} U]
= - \vec{\nabla} P + \zeta \vec{E} + \frac{1}{c} \vec{J} \times \vec{B}
\,.
\end{align}

We haven't done the energy conservation equation since it will not be useful for our purposes, while being very lengthy.
Still, in principle we should use it.

We will now make the \textbf{ideal MHD approximation}, in which the conductivity is assumed to be very high.
Still, there are situations in which the resistivity becomes high locally.
This can happen through a phenomenon called \emph{reconnection}, for example.

Suppose we have an electric field in the lab frame: in the frame comoving with the plasma, it will look like \(\vec{E} \to \vec{E} + \vec{U} \times \vec{B} / c\).

This can be described by Ohm's law,
%
\begin{align}
\vec{E} + \frac{1}{c} \vec{U} \times \vec{B} = \eta \vec{J}
\,.
\end{align}

Using the Ampére-Maxwell equation we get that the current reads
%
\begin{align}
\vec{J} = \frac{c}{4 \pi } \qty[\vec{\nabla} \times \vec{B} - \frac{1}{c} \pdv{\vec{E}}{t}]
\,.
\end{align}

We assume that \(\eta \) is very small.
In the \(\eta = 0 \) case, in the lab reference frame we get
%[]
\begin{align}
\vec{E} = - \frac{1}{c} \vec{U} \times \vec{B}
\,.
\end{align}

What is the order of magnitude of \(\vec{J} \times \vec{B}  / c\)?
%
\begin{align}
\frac{1}{4 \pi } \qty[\vec{\nabla} \times \vec{B} - \frac{1}{c} \pdv{\vec{E}}{t} ] \times \vec{B} \sim \frac{B^2}{UT} + \frac{U}{c^2} \frac{B^2}{T}
\,,
\end{align}
%
The first term has scale \(B^2 / L\), the second has scale \((U/c^2) (B^2 /T)\).

We can then see that under this low-resistivity assumption the second term can be neglected.

Then, the equation just reads
%
\begin{align}
\rho \qty[ \pdv{\vec{U}}{t} + \vec{U} \cdot \vec{\nabla} U]
= - \vec{\nabla} P + \frac{1}{4 \pi } (\vec{\nabla} \times \vec{B}) \times \vec{B}
\,.
\end{align}

There is an interesting implication to this equation known as \textbf{flux freezing}.

The assumption of ideal MHD is that there is no dissipation: the field lines cannot cross; we can ``squeeze'' them, but the flux will be preserved.

Let us take a surface \(S_0 \), and compute the magnetic field flux across it at \(t = t_0 \):
%
\begin{align}
\Phi_0 = \int \dd{\vec{S}_0} \vec{B} (\vec{x}, t_0 )
\,,
\end{align}
%
which we want to compare to the flux across the same surface, transported along the fluid motion:
%
\begin{align}
\Phi_1 &= \int \dd{S_1} \vec{B} (\vec{x} + \vec{v} \dd{t}, t_0 + \dd{t})   \\
&= \int \dd{S_1} \qty[
    \vec{B} (\vec{x} + \vec{v} \dd{t}, t_0 )
    + \pdv{\vec{B}}{t} (\vec{x} + \vec{v} \dd{t}, t_0 ) \dd{t}
]
\,.
\end{align}

If we include \(S_0 \), \(S_1 \) as well as the boundary \(S_2 \) we will get a closed surface.
The integral over \(S = - S_0 + S_1  + S_2 \) will be
%
\begin{align}
\oint_S \vec{B} \cdot \dd{S} = 0
\,,
\end{align}
%
where we write \(- S_0 \) since the normal to that surface must be oriented outward.

From this equation we get that
%
\begin{align}
\Phi_0 = \int \dd{S_1} B + \int \dd{S_2} B
\,.
\end{align}

What is \(\dd{S_2}\)? It can be written as \(\dd{\ell} \wedge \vec{v} \dd{t}\), since we are asking that we move along the flux lines of the fluid.

We know that
%
\begin{align}
\Phi_1
&= \Phi_0 - \int \dd{\vec{S}_1} \cdot \vec{B}
 + \dd{t} \int \dd{\vec{S}_1} \pdv{\vec{B}}{t} (\vec{x} + \vec{v} \dd{t} , t_0 )  \\
&= \Phi_0 - \dd{t} \int (\dd{\vec{\ell}} \times \vec{c}) \cdot \vec{B}
 + \dd{t} \int \dd{\vec{S}_1} \pdv{\vec{B}}{t} (\vec{x} + \vec{v} \dd{t} , t_0 )  \\
&= \Phi_0 - \int \dd{t} (\vec{v} \times \vec{B}) \cdot \dd{\ell} + \dd{t} \int \pdv{\vec{B}}{t} \dd{S}  \\
&= \Phi_0 - \dd{t} \int \dd{S} \qty[ \vec{\nabla} \times (\vec{\nabla} \times \vec{B}) + \pdv{\vec{B}}{t}]
\,,
\end{align}
%
but since
%
\begin{align}
\vec{E} = - \frac{1}{c} \vec{v} \times \vec{B}
\qquad \text{and} \qquad
\pdv{\vec{B}}{t} = - c \vec{\nabla} \times \vec{E}
\,,
\end{align}
%
we get that the integrand vanishes.

\todo[inline]{Check this derivation, something seems fishy. We should compute everything at the same time! }

\end{document}


\subsection{Validation sets}

which features? remove, add?

change lambda,regularisation

change polynomial features