\chapter{Funcoids are filters}\label{fcd-filters}

The motto of this chapter is: ``Funcoids are filters on a (boolean) lattice.''

\section{Rearrangement of collections of sets}

Let $Q$ be a set of sets.

Let $\equiv$ be the relation on $\bigcup Q$ defined by the formula
\[
a\equiv b\Leftrightarrow\forall X\in Q:(a\in X\Leftrightarrow b\in X).
\]

\begin{prop}
$\equiv$ is an equivalence relation on $\bigcup Q$.\end{prop}
\begin{proof}
~
\begin{description}
\item [{Reflexivity}] Obvious.
\item [{Symmetry}] Obvious.
\item [{Transitivity}] Let $a\equiv b\wedge b\equiv c$. Then $a\in X\Leftrightarrow b\in X\Leftrightarrow c\in X$
for every $X\in Q$. Thus $a\equiv c$.
\end{description}
\end{proof}
\begin{defn}
\emph{Rearrangement} $\mathfrak{R}(Q)$ of $Q$ is the set of equivalence
classes of $\bigcup Q$ for $\equiv$.\end{defn}
\begin{obvious}
$\bigcup\mathfrak{R}(Q)=\bigcup Q$.
\end{obvious}

\begin{obvious}
$\emptyset\notin\mathfrak{R}(Q)$.\end{obvious}
\begin{lem}
$\card\mathfrak{R}(Q)\leq2^{\card Q}$.\end{lem}
\begin{proof}
Having an equivalence class $C$, we can find the set $f\in\subsets Q$
of all $X\in Q$ such that $a\in X$, for every $a\in C$.
\[
b\equiv a\Leftrightarrow\forall X\in Q:(a\in X\Leftrightarrow b\in X)\Leftrightarrow\forall X\in Q:(X\in f\Leftrightarrow b\in X).
\]
So $C=\setcond{b\in\bigcup Q}{b\equiv a}$ can be restored knowing
$f$. Consequently there are no more than $\card\subsets Q=2^{\card Q}$
classes.\end{proof}
\begin{cor}
If $Q$ is finite, then $\mathfrak{R}(Q)$ is finite.\end{cor}
\begin{prop}
If $X\in Q$, $Y\in\mathfrak{R}(Q)$ then $X\cap Y\neq\emptyset\Leftrightarrow Y\subseteq X$.\end{prop}
\begin{proof}
Let $X\cap Y\neq\emptyset$ and $x\in X\cap Y$. Then
\[
y\in Y\Leftrightarrow x\equiv y\Leftrightarrow\forall X'\in Q:(x\in X'\Leftrightarrow y\in X')\Rightarrow(x\in X\Leftrightarrow y\in X)\Leftrightarrow y\in X
\]
 for every $y$. Thus $Y\subseteq X$.

$Y\subseteq X\Rightarrow X\cap Y\neq\emptyset$ because $Y\neq\emptyset$.\end{proof}
\begin{prop}
If $\emptyset\neq X\in Q$ then there exists $Y\in\mathfrak{R}(Q)$
such that $Y\subseteq X\wedge X\cap Y\neq\emptyset$.\end{prop}
\begin{proof}
Let $a\in X$. Then
\begin{multline*}
[a]=\setcond{b\in\bigcup Q}{\forall X'\in Q:(a\in X'\Leftrightarrow b\in X')}\subseteq\\
\setcond{b\in\bigcup Q}{a\in X\Leftrightarrow b\in X} = \setcond{b\in\bigcup Q}{b\in X}=X.
\end{multline*}
But $[a]\in\mathfrak{R}(Q)$.

$X\cap Y\neq\emptyset$ follows from $Y\subseteq X$ by the previous
proposition.\end{proof}
\begin{prop}
If $X\in Q$ then $X=\bigcup(\mathfrak{R}(Q)\cap\subsets X)$.\end{prop}
\begin{proof}
$\bigcup(\mathfrak{R}(Q)\cap\subsets X)\subseteq X$ is obvious.

Let $x\in X$. Then there is $Y\in\mathfrak{R}(Q)$ such that $x\in Y$.
We have $Y\subseteq X$ that is $Y\in\subsets X$ by a proposition
above. So $x\in Y$ where $Y\in\mathfrak{R}(Q)\cap\subsets X$ and
thus $x\in\bigcup(\mathfrak{R}(Q)\cap\subsets X)$. We have $X\subseteq\bigcup(\mathfrak{R}(Q)\cap\subsets X)$.
\end{proof}

\section{Finite unions of Cartesian products}

Let $A$, $B$ be sets.

I will denote $\overline{X}=A\setminus X$.

Let denote $\Gamma(A,B)$ the set of all finite unions $X_{0}\times Y_{0}\cup\ldots\cup X_{n-1}\times Y_{n-1}$
of Cartesian products, \ where $n\in\mathbb{N}$ and $X_{i}\in\subsets A$,
$Y_{i}\in\subsets B$ for every $i=0,\ldots,n-1$.
\begin{prop}
The following sets are pairwise equal:
\begin{enumerate}
\item \label{gamma-gamma}$\Gamma(A,B)$;
\item \label{gamma-YX}the set of all sets of the form $\bigcup_{X\in S}(X\times Y_{X})$
where $S$ are finite collections on $A$ and $Y_{X}\in\subsets B$
for every $X\in S$;
\item \label{gamma-YXpart}the set of all sets of the form $\bigcup_{X\in S}(X\times Y_{X})$
where $S$ are finite partitions of $A$ and $Y_{X}\in\subsets B$
for every $X\in S$;
\item \label{gamma-sigma}the set of all finite unions $\bigcup_{(X,Y)\in\sigma}(X\times Y)$
where $\sigma$ is a relation between a partition of $A$ and a partition
of $B$ (that is $\dom\sigma$ is a partition of $A$ and $\im\sigma$
is a partition of $B$).
\item \label{gamma-lineX}the set of all finite intersections $\bigcap_{i=0,\ldots,n-1}\left(X_{i}\times Y_{i}\cup\overline{X_{i}}\times B\right)$
where $n\in\mathbb{N}$ and $X_{i}\in\subsets A$, $Y_{i}\in\subsets B$
for every $i=0,\ldots,n-1$.
\end{enumerate}
\end{prop}
\begin{proof}
~
\begin{description}
\item [{\ref{gamma-gamma}$\supseteq$\ref{gamma-YX},~\ref{gamma-YX}$\supseteq$\ref{gamma-YXpart}}] Obvious.
\item [{\ref{gamma-gamma}$\subseteq$\ref{gamma-YX}}] Let $Q\in\Gamma(A,B)$.
Then $Q=X_{0}\times Y_{0}\cup\ldots\cup X_{n-1}\times Y_{n-1}$. Denote
$S=\{X_{0},\ldots,X_{n-1}\}$. We have $Q=\bigcup_{X'\in S}\left(X'\times\bigcup_{i=0,\dots,n-1}\setcond{Y_{i}}{X_{i}=X'}\right)\in\text{\ref{gamma-YX}}$.
\item [{\ref{gamma-YX}$\subseteq$\ref{gamma-YXpart}}] Let $Q=\bigcup_{X\in S}(X\times Y_{X})$
where $S$ is a finite collection on $A$ and $Y_{X}\in\subsets B$
for every $X\in S$. Let
\[
P=\bigcup_{X'\in\mathfrak{R}(S)}\left(X'\times\bigcup_{X\in S}\setcond{Y_{X}}{\exists X\in S:X'\subseteq X}\right).
\]
To finish the proof let's show $P=Q$.

$\langle P\rangle^{\ast}\{x\}=\bigcup_{X\in S}\setcond{Y_{X}}{\exists X\in S:X'\subseteq X}$
where $x\in X'$.

Thus $\langle P\rangle^{\ast}\{x\}=\bigcup\setcond{Y_{X}}{\exists X\in S:x\in X}=\langle Q\rangle^{\ast}\{x\}$.
So $P=Q$.

\item [{\ref{gamma-sigma}$\subseteq$\ref{gamma-YXpart}}] $\bigcup_{(X,Y)\in\sigma}(X\times Y)=\bigcup_{X\in\dom\sigma}\left(X\times\bigcup\setcond{Y\in\subsets B}{(X,Y)\in\sigma}\right)\in\text{\text{\ref{gamma-YXpart}}}$.
\item [{\ref{gamma-YXpart}$\subseteq$\ref{gamma-sigma}}]
\begin{multline*}
\bigcup_{X\in S}(X\times Y_{X})=\bigcup_{X\in S}\left(X\times\bigcup\left(\mathfrak{R}\left(\setcond{Y_{X}}{X\in S}\right)\cap\subsets Y_{X}\right)\right)=\\
\bigcup_{X\in S}\left(X\times\bigcup\setcond{Y'\in\mathfrak{R}\left(\setcond{Y_{X}}{X\in S}\right)}{Y'\subseteq Y_{X}}\right)=\\
\bigcup_{X\in S}\left(X\times\bigcup\setcond{Y'\in\mathfrak{R}\left(\setcond{Y_{X}}{X\in S}\right)}{(X,Y')\in\sigma}\right)=\bigcup_{(X,Y)\in\sigma}(X\times Y)
\end{multline*}
 where $\sigma$ is a relation between $S$ and $\mathfrak{R}\left(\setcond{Y_{X}}{X\in S}\right)$,
and $(X,Y')\in\sigma\Leftrightarrow Y'\subseteq Y_{X}$.
\item [{\ref{gamma-lineX}$\subseteq$\ref{gamma-gamma}}] Obvious.
\item [{\ref{gamma-YXpart}$\subseteq$\ref{gamma-lineX}}] Let $Q=\bigcup_{X\in S}(X\times Y_{X})=\bigcup_{i=0,\ldots,n-1}(X_{i}\times Y_{i})$
for a partition $S=\{X_{0},\ldots,X_{n-1}\}$ of $A$. Then $Q=\bigcap_{i=0,\ldots,n-1}\left(X_{i}\times Y_{i}\cup\overline{X_{i}}\times B\right)$.
\end{description}
\end{proof}
\begin{xca}
Formulate the duals of these sets.\end{xca}
\begin{prop}
$\Gamma(A,B)$ is a boolean lattice, a sublattice of the lattice $\subsets(A\times B)$.\end{prop}
\begin{proof}
That it's a sublattice is obvious. That it has complement, is also
obvious. Distributivity follows from distributivity of $\subsets(A\times B)$.
\end{proof}

\section{Before the diagram}

Next we will prove the below theorem \ref{fcd-diagram} (the theorem
with a diagram). First we will present parts of this theorem as several
lemmas, and then then state a statement about the diagram which concisely
summarizes the lemmas (and their easy consequences).

Below for simplicity we will equate reloids with their graphs (that
is with filters on binary cartesian products).
\begin{obvious}
$\up^{\Gamma(\Src f,\Dst f)}f=(\up f)\cap\Gamma$ for every reloid
$f$.\end{obvious}
\begin{conjecture}
$\upuparrows^{\mathfrak{F}(\mathfrak{B})}\up^{\mathfrak{A}}\mathcal{X}$
is not a filter for some filter $\mathcal{X}\in\mathfrak{F}\Gamma(A,B)$
for some sets $A$, $B$.\end{conjecture}
\begin{rem}
About this conjecture see also:
\begin{itemize}
\item \href{http://goo.gl/DHyuuU}{http://goo.gl/DHyuuU}
\item \href{http://goo.gl/4a6wY6}{http://goo.gl/4a6wY6}
\end{itemize}
\end{rem}
\begin{lem}
\label{faf-bij}Let $A$, $B$ be sets. The following are mutually
inverse order isomorphisms between $\mathfrak{F}\Gamma(A,B)$ and
$\mathsf{FCD}(A,B)$:
\begin{enumerate}
\item $\mathcal{A}\mapsto\bigsqcap^{\mathsf{FCD}}\up\mathcal{A}$;
\item $f\mapsto\up^{\Gamma(A,B)}f$.
\end{enumerate}
\end{lem}
\begin{proof}
Let's prove that $\up^{\Gamma(A,B)}f$ is a filter for every funcoid
$f$. We need to prove that $P\cap Q\in\up f$ whenever
\[
P=\bigcap_{i=0,\ldots,n-1}\left(X_{i}\times Y_{i}\cup\overline{X_{i}}\times B\right)\quad\text{and}\quad Q=\bigcap_{j=0,\ldots,m-1}\left(X'_{j}\times Y'_{j}\cup\overline{X'_{j}}\times B\right).
\]
This follows from $P\in\up f\Leftrightarrow\forall i\in0,\ldots,n-1:\supfun fX_{i}\subseteq Y_{i}$
and likewise for $Q$, so having $\supfun f(X_{i}\cap X'_{j})\subseteq Y_{i}\cap Y'_{j}$
for every $i=0,\ldots,n-1$ and $j=0,\ldots,m-1$. From this it follows
\[
((X_{i}\cap X'_{j})\times(Y_{i}\cap Y'_{j}))\cup\left(\overline{X_{i}\cap X'_{j}}\times B\right)\supseteq f
\]
and thus $P\cap Q\in\up f$.

Let $\mathcal{A}$, $\mathcal{B}$ be filters on $\Gamma$. Let $\bigsqcap^{\mathsf{FCD}}\up\mathcal{A}=\bigsqcap^{\mathsf{FCD}}\up\mathcal{B}$.
We need to prove $\mathcal{A}=\mathcal{B}$. (The rest follows from
proof of the lemma~\ref{fcd-rep}). We have:
\begin{align*}
\mathcal{A}=\bigsqcap^{\mathsf{FCD}}\setcond{X\times Y\cup\overline{X}\times B\in\up\mathcal{A}}{X\in\subsets A,Y\in\subsets B} & =\\
\bigsqcap^{\mathsf{FCD}}\setcond{X\times Y\cup\overline{X}\times B}{X\in\subsets A,Y\in\subsets B,\exists P\in\up\mathcal{A}:P\subseteq X\times Y\cup\overline{X}\times B} & =\\
\bigsqcap^{\mathsf{FCD}}\setcond{X\times Y\cup\overline{X}\times B}{X\in\subsets A,Y\in\subsets B,\exists P\in\up\mathcal{A}:\rsupfun PX\subseteq Y} & =\text{(*)}\\
\bigsqcap^{\mathsf{FCD}}\setcond{X\times Y\cup\overline{X}\times B}{X\in\subsets A,Y\in\subsets B,\bigsqcap\setcond{\rsupfun PX}{X\in\up\mathcal{A}}\sqsubseteq Y} & =\\
\bigsqcap^{\mathsf{FCD}}\setcond{X\times Y\cup\overline{X}\times B}{X\in\subsets A,Y\in\subsets B,\bigsqcap\setcond{\rsupfun PX}{X\in\up\bigsqcap^{\mathsf{RLD}}\up\mathcal{A}}\sqsubseteq Y} & =\\
\bigsqcap^{\mathsf{FCD}}\setcond{X\times Y\cup\overline{X}\times B}{X\in\subsets A,Y\in\subsets B,\left\langle \tofcd\bigsqcap^{\mathsf{RLD}}\up\mathcal{A}\right\rangle X\sqsubseteq Y} & =\text{(**)}\\
\bigsqcap^{\mathsf{FCD}}\setcond{X\times Y\cup\overline{X}\times B}{X\in\subsets A,Y\in\subsets B,\left\langle \bigsqcap^{\mathsf{FCD}}\up\bigsqcap^{\mathsf{RLD}}\up\mathcal{A}\right\rangle X\sqsubseteq Y} & =\\
\bigsqcap^{\mathsf{FCD}}\setcond{X\times Y\cup\overline{X}\times B}{X\in\subsets A,Y\in\subsets B,\left\langle \bigsqcap^{\mathsf{FCD}}\up\mathcal{A}\right\rangle X\sqsubseteq Y}.
\end{align*}

({*}) by properties of generalized filter bases, because $\setcond{\rsupfun PX}{P\in\up\mathcal{A}}$
is a filter base.

({*}{*}) by theorem \ref{fcd-as-meet}.

Similarly
\[
\mathcal{B}=\bigsqcap^{\mathsf{FCD}}\setcond{X\times Y\cup\overline{X}\times B}{X\in\subsets A,Y\in\subsets B,\left\langle \bigsqcap^{\mathsf{FCD}}\up\mathcal{B}\right\rangle X\sqsubseteq Y}.
\]
Thus $\mathcal{A}=\mathcal{B}$.\end{proof}
\begin{prop}
$g\circ f\in\Gamma(A,C)$ if $f\in\Gamma(A,B)$ and $g\in\Gamma(B,C)$
for some sets $A$, $B$, $C$.\end{prop}
\begin{proof}
Because composition of Cartesian products is a Cartesian product.\end{proof}
\begin{defn}
$g\circ f=\bigsqcap^{\mathfrak{F}\Gamma(A,C)}\setcond{G\circ F}{F\in\up f,G\in\up g}$
for $f\in\mathfrak{F}\Gamma(A,B)$ and $g\in\mathfrak{F}\Gamma(B,C)$
(for every sets $A$, $B$, $C$).
\end{defn}
We define $f^{-1}$ for $f\in\mathfrak{F}\Gamma(A,B)$ similarly to
$f^{-1}$ for reloids and similarly derive the formulas:
\begin{enumerate}
\item $(f^{-1})^{-1}=f$;
\item $(g\circ f)^{-1}=f^{-1}\circ g^{-1}$.
\end{enumerate}

\section{Associativity over composition}
\begin{lem}
\label{uparr-gamma-comp}$\bigsqcap^{\mathsf{RLD}}\up^{\Gamma(A,C)}(g\circ f)=\left(\bigsqcap^{\mathsf{RLD}}\up^{\Gamma(B,C)}g\right)\circ\left(\bigsqcap^{\mathsf{RLD}}\up^{\Gamma(B,C)}\right)$
for every $f\in\mathfrak{F}(\Gamma(A,B))$, $g\in\mathfrak{F}(\Gamma(B,C))$
(for every sets $A$, $B$, $C$).\end{lem}
\begin{proof}
If $K\in\up\bigsqcap^{\mathsf{RLD}}\up^{\Gamma(A,C)}(g\circ f)$ then
$K\supseteq G\circ F$ for some $F\in f$, $G\in g$. But $F\in\up^{\Gamma(A,B)}f$,
thus
\[
F\in\bigsqcap^{\mathsf{RLD}}\up^{\Gamma(A,B)}f
\]
and similarly
\[
G\in\bigsqcap^{\mathsf{RLD}}\up^{\Gamma(B,C)}g.
\]
So we have
\[
K\supseteq G\circ F\in\up\left(\left(\bigsqcap^{\mathsf{RLD}}\up^{\Gamma(B,C)}g\right)\circ\left(\bigsqcap^{\mathsf{RLD}}\up^{\Gamma(A,B)}f\right)\right).
\]
Let now
\[
K\in\up\left(\left(\bigsqcap^{\mathsf{RLD}}\up^{\Gamma(B,C)}g\right)\circ\left(\bigsqcap^{\mathsf{RLD}}\up^{\Gamma(A,B)}f\right)\right).
\]
Then there exist $F\in\up\bigsqcap^{\mathsf{RLD}}\up^{\Gamma(A,B)}f$
and $G\in\up\bigsqcap^{\mathsf{RLD}}\up^{\Gamma(B,C)}g$ such that
$K\supseteq G\circ F$. By properties of generalized filter bases
we can take $F\in\up^{\Gamma(A,B)}f$ and $G\in\up^{\Gamma(B,C)}g$.
Thus $K\in\up^{\Gamma(A,C)}(g\circ f)$ and so $K\in\up\bigsqcap^{\mathsf{RLD}}\up^{\Gamma(A,C)}(g\circ f)$.\end{proof}
\begin{lem}
$\torldin X=X$ for $X\in\Gamma(A,B)$.\end{lem}
\begin{proof}
$X=X_{0}\times Y_{0}\cup\ldots\cup X_{n}\times Y_{n}=(X_{0}\times^{\mathsf{FCD}}Y_{0})\sqcup^{\mathsf{FCD}}\ldots\sqcup^{\mathsf{FCD}}(X_{n}\times^{\mathsf{FCD}}Y_{n})$.
\begin{multline*}
\torldin X=\\
\torldin(X_{0}\times^{\mathsf{FCD}}Y_{0})\sqcup^{\mathsf{RLD}}\ldots\sqcup^{\mathsf{RLD}}\torldin(X_{n}\times^{\mathsf{FCD}}Y)=\\
(X_{0}\times^{\mathsf{RLD}}Y_{0})\sqcup^{\mathsf{RLD}}\ldots\sqcup^{\mathsf{RLD}}(X_{n}\times^{\mathsf{RLD}}Y_{n})=\\
X_{0}\times Y_{0}\cup\ldots\cup X_{n}\times Y_{n}=X.
\end{multline*}
\end{proof}
\begin{lem}
\label{rld-in-fcd-meet}$\bigsqcap^{\mathsf{RLD}} f=\torldin\bigsqcap^{\mathsf{FCD}} f$
for every filter $f\in\mathfrak{F}\Gamma(A,B)$.\end{lem}
\begin{proof}
~
\[
\torldin\bigsqcap^{\mathsf{FCD}} f=\bigsqcap^{\mathsf{RLD}}\rsupfun{\torldin} f=
\text{(by the previous lemma)}=\bigsqcap^{\mathsf{RLD}} f.
\]
\end{proof}
\begin{lem}
\label{rld-gamma-bij}~
\begin{enumerate}
\item \label{rld-gamma-bij-mu}$f\mapsto\bigsqcap^{\mathsf{RLD}}\up f$
and $\mathcal{A}\mapsto\Gamma(A,B)\cap\up\mathcal{A}$ are mutually
inverse bijections between $\mathfrak{F}\Gamma(A,B)$ and a subset
of reloids.
\item \label{rld-gamma-bij-comp}These bijections preserve composition.
\end{enumerate}
\end{lem}
\begin{proof}
~
\begin{widedisorder}
\item [{\ref{rld-gamma-bij-mu}}] That they are mutually inverse bijections
is obvious.
\item [{\ref{rld-gamma-bij-comp}}] ~
\begin{multline*}
\left(\bigsqcap^{\mathsf{RLD}}\up g\right)\circ\left(\bigsqcap^{\mathsf{RLD}}\up f\right)=\bigsqcap^{\mathsf{RLD}}\setcond{G\circ F}{F\in\bigsqcap^{\mathsf{RLD}}f,G\in\bigsqcap^{\mathsf{RLD}}g}=\\
\bigsqcap^{\mathsf{RLD}}\setcond{G\circ F}{F\in f,G\in g}=\bigsqcap^{\mathsf{RLD}}\bigsqcap^{\mathfrak{F}\Gamma(\Src f,\Dst g)}\setcond{G\circ F}{F\in f,G\in g}=\bigsqcap^{\mathsf{RLD}}(g\circ f).
\end{multline*}
So $\bigsqcap^{\mathsf{RLD}}$ preserves composition. That $\mathcal{A}\mapsto\Gamma(A,B)\cap\up\mathcal{A}$
preserves composition follows from properties of bijections.
\end{widedisorder}
\end{proof}
\begin{lem}
Let $A$, $B$, $C$ be sets.
\begin{enumerate}
\item $\left(\bigsqcap^{\mathsf{FCD}}\up g\right)\circ\left(\bigsqcap^{\mathsf{FCD}}\up f\right)=\bigsqcap^{\mathsf{FCD}}\up(g\circ f)$
for every $f\in\mathfrak{F}\Gamma(A,B)$, $g\in\mathfrak{F}\Gamma(B,C)$;
\item $(\up^{\Gamma(B,C)}g)\circ(\up^{\Gamma(A,B)}f)=\up^{\Gamma(A,B)}(g\circ f)$
for every funcoids $f\in\mathsf{FCD}(A,B)$ and $g\in\mathsf{FCD}(B:C)$.
\end{enumerate}
\end{lem}
\begin{proof}
It's enough to prove only the first formula, because of the bijection
from lemma~\ref{faf-bij}.

Really:
\begin{multline*}
\bigsqcap^{\mathsf{FCD}}\up(g\circ f)=\bigsqcap^{\mathsf{FCD}}\up\bigsqcap^{\mathsf{RLD}}\up(g\circ f)=\\
\bigsqcap^{\mathsf{FCD}}\up\left(\bigsqcap^{\mathsf{RLD}}\up g\circ\bigsqcap^{\mathsf{RLD}}\up f\right)=\tofcd\left(\bigsqcap^{\mathsf{RLD}}\up g\circ\bigsqcap^{\mathsf{RLD}}\up f\right)=\\
\left(\tofcd\bigsqcap^{\mathsf{RLD}}\up g\right)\circ\left(\tofcd\bigsqcap^{\mathsf{RLD}}\up f\right)=\\
\left(\bigsqcap^{\mathsf{FCD}}\up\bigsqcap^{\mathsf{RLD}}\up g\right)\circ\left(\bigsqcap^{\mathsf{FCD}}\up\bigsqcap^{\mathsf{RLD}}\up f\right)=\\
\left(\bigsqcap^{\mathsf{FCD}}\up g\right)\circ\left(\bigsqcap^{\mathsf{FCD}}\up f\right).
\end{multline*}
\end{proof}
\begin{cor}
$(h\circ g)\circ f=h\circ(g\circ f)$ for every $f\in\mathfrak{F}(\Gamma(A,B))$,
$g\in\mathfrak{F}\Gamma(B,C)$, $h\in\mathfrak{F}\Gamma(C,D)$ for
every sets $A$, $B$, $C$, $D$.\end{cor}
\begin{lem}
$\Gamma(A,B)\cap\GR f$ is a filter on the lattice $\Gamma(A,B)$
for every reloid $f\in\mathsf{RLD}(A,B)$.\end{lem}
\begin{proof}
That it is an upper set, is obvious. If $A,B\in\Gamma(A,B)\cap\GR f$
then $A,B\in\Gamma(A,B)$ and $A,B\in\GR f$. Thus $A\cap B\in\Gamma(A,B)\cap\GR f$.\end{proof}
\begin{prop}
If $Y\in\up\supfun f\mathcal{X}$ for a funcoid $f$ then there exists
$A\in\up\mathcal{X}$ such that $Y\in\up\langle f\rangle A$.\end{prop}
\begin{proof}
$Y\in\up\bigsqcap_{A\in\up a}^{\mathscr{F}}\supfun fA$. So by properties
of generalized filter bases, there exists $A\in\up a$ such that $Y\in\up\supfun fA$.\end{proof}
\begin{lem}
$\tofcd f=\bigsqcap^{\mathsf{FCD}}(\Gamma(A,B)\cap\GR f)$ for every
reloid $f\in\mathsf{RLD}(A,B)$.\end{lem}
\begin{proof}
Let $a$ be an an atomic filter object. We need to prove
\[
\supfun{\tofcd f}a=\supfun{\bigsqcap^{\mathsf{FCD}}(\Gamma(A,B)\cap\GR f)}a
\]
that is
\[
\supfun{\bigsqcap^{\mathsf{FCD}}\up f}a=\supfun{\bigsqcap^{\mathsf{FCD}}(\Gamma(A,B)\cap\GR f)}a
\]
that is
\[
\bigsqcap_{F\in\up f}^{\mathscr{F}}\supfun Fa=\bigsqcap_{F\in\Gamma(A,B)\cap\up f}^{\mathscr{F}}\supfun Fa.
\]
For this it's enough to prove that $Y\in\up\supfun Fa$ for some $F\in\up f$
implies $Y\in\up\supfun{F'}a$ for some $F'\in\Gamma(A,B)\cap\GR f$.

Let $Y\in\up\supfun Fa$. Then (proposition above) there exists $A\in\up a$
such that $Y\in\up\supfun FA$.

$Y\in\up\supfun{A\times^{\mathsf{FCD}}Y\sqcup\overline{A}\times^{\mathsf{FCD}}\top}a$;
$\supfun{A\times^{\mathsf{FCD}}Y\sqcup\overline{A}\times^{\mathsf{FCD}}\top}\mathcal{X}=Y\in\up\supfun F\mathcal{X}$
if $\bot\neq\mathcal{X}\sqsubseteq A$ and $\supfun{A\times^{\mathsf{FCD}}Y\sqcup\overline{A}\times^{\mathsf{FCD}}\top}\mathcal{X}=\top\in\up\langle F\rangle\mathcal{X}$
if $\mathcal{X}\nsqsubseteq A$.

Thus $A\times^{\mathsf{FCD}}Y\sqcup\overline{A}\times^{\mathsf{FCD}}\top\sqsupseteq F$.
So $A\times^{\mathsf{FCD}}Y\sqcup\overline{A}\times^{\mathsf{FCD}}\top$
is the sought for~$F'$.
\end{proof}

\section{The diagram}
\begin{thm}
\label{fcd-diagram}The diagram at the figure~\ref{gamma-dia} is
a commutative diagram (in category $\mathbf{Set}$), every arrow in
this diagram is an isomorphism. Every cycle in this diagram is an
identity (therefore ``parallel'' arrows are mutually inverse). The
arrows preserve order, composition, and reversal ($f\mapsto f^{-1}$).

\begin{figure}[ht]
\begin{tikzcd}[row sep=3cm, column sep=0.9cm]
& \text{funcoids}
\arrow[rd, shift left, "\up^\Gamma"]
\arrow[ld, shift left, "\torldin"] \\
\text{funcoidal reloids}
\arrow[ru, shift left, "\tofcd"]
\arrow[rr, shift left, "f\mapsto f\cap\Gamma"]
& & \text{filters on $\Gamma$}
\arrow[lu, shift left, "\bigsqcap^{\mathsf{FCD}}"]
\arrow[ll, shift left, "\bigsqcap^{\mathsf{RLD}}"]
\end{tikzcd}
\caption{\label{gamma-dia}}
\end{figure}
\end{thm}
\begin{proof}
First we need to show that $\bigsqcap^{\mathsf{RLD}}f$ is a funcoidal
reloid. But it follows from lemma~\ref{rld-in-fcd-meet}.

Next, we need to show that all morphisms depicted on the diagram are
bijections and the depicted ``opposite'' morphisms are mutually
inverse.

That $\tofcd$ and $\torldin$ are mutually inverse was proved above
in the book.

That $\bigsqcap^{\mathsf{RLD}}$ and $f\mapsto f\cap\Gamma$ are mutually
inverse was proved above.

That $\bigsqcap^{\mathsf{FCD}}$ and $\up^{\Gamma}$ are mutually
inverse was proved above.

That the morphisms preserve order and composition was proved above.
That they preserve reversal is obvious.

So it remains to apply lemma~\ref{three-loop-lem} (taking into account
lemma~\ref{rld-in-fcd-meet}).
\end{proof}

Another proof that $\tofcd\torldin f=f$ for every funcoid $f$:
\begin{proof}
For every filter $\mathcal{X}\in\mathscr{F}(\Src f)$ we have $\langle\tofcd\torldin f\rangle\mathcal{X}=\bigsqcap_{F\in\up\torldin f}^{\mathscr{F}}\supfun F\mathcal{X}=\bigsqcap_{F\in\up^{\Gamma(\Src f,\Dst f)}f}^{\mathscr{F}}\supfun F\mathcal{X}$.

Obviously $\bigsqcap_{F\in\up^{\Gamma(\Src f,\Dst f)}f}^{\mathscr{F}}\supfun F\mathcal{X}\sqsupseteq\supfun f\mathcal{X}$.
So $\tofcd\torldin f\sqsupseteq f$.

Let $Y\in\up\supfun f\mathcal{X}$. Then (proposition above) there
exists $A\in\up\mathcal{X}$ such that $Y\in\up\langle f\rangle A$.

Thus $A\times Y\sqcup\overline{A}\times\top\in\up f$. So $\supfun{\tofcd\torldin f}\mathcal{X}=\bigsqcap_{F\in\up^{\Gamma(\Src f,\Dst f)}f}^{\mathscr{F}}\supfun F\mathcal{X}\sqsubseteq\supfun{A\times Y\sqcup\overline{A}\times\top}\mathcal{X}=Y$.
So $Y\in\up\supfun{\tofcd\torldin f}\mathcal{X}$ that
is $\supfun f\mathcal{X}\sqsupseteq\supfun{\tofcd\torldin f}\mathcal{X}$
that is $f\sqsupseteq\tofcd\torldin f$.\end{proof}

\section{Some additional properties}
\begin{prop}
For every funcoid $f\in\mathsf{FCD}(A,B)$ (for sets $A$, $B$):
\begin{enumerate}
\item $\dom f=\bigsqcap^{\mathscr{F}(A)}\langle\dom\rangle^{\ast}\up^{\Gamma(A,B)}f$;
\item $\im f=\bigsqcap^{\mathscr{F}(B)}\langle\im\rangle^{\ast}\up^{\Gamma(A,B)}f$.
\end{enumerate}
\end{prop}
\begin{proof}
Take $\setcond{X\times Y}{X\in\subsets A,Y\in\subsets B,X\times Y\supseteq f}\subseteq\up^{\Gamma(A,B)}f$.
I leave the rest reasoning as an exercise.\end{proof}
\begin{thm}
For every reloid $f$ and $\mathcal{X}\in\mathscr{F}(\Src f)$, $\mathcal{Y}\in\mathscr{F}(\Dst f)$:
\begin{enumerate}
\item \label{fcd-up-g-rel}$\mathcal{X}\mathrel{[\tofcd f]}\mathcal{Y}\Leftrightarrow\forall F\in\up^{\Gamma(\Src f,\Dst f)}f:\mathcal{X}\suprel F\mathcal{Y}$;
\item \label{fcd-up-g-fcd}$\langle\tofcd f\rangle\mathcal{X}=\bigsqcap_{F\in\up^{\Gamma(\Src f,\Dst f)}f}^{\mathscr{F}}\supfun F\mathcal{X}$.
\end{enumerate}
\end{thm}
\begin{proof}
~
\begin{widedisorder}
\item [{\ref{fcd-up-g-rel}}] ~
\begin{multline*}
\forall F\in\up^{\Gamma(\Src f,\Dst f)}f:\mathcal{X}\suprel F\mathcal{Y}\Leftrightarrow\\
\forall F\in\up^{\Gamma(\Src f,\Dst f)}f:(\mathcal{X}\times^{\mathsf{FCD}}\mathcal{Y})\sqcap F\ne\bot\Leftrightarrow\text{(*)}\\
(\mathcal{X}\times^{\mathsf{FCD}}\mathcal{Y})\sqcap \bigsqcap^{\mathsf{FCD}}\up^{\Gamma(\Src f,\Dst f)}f\ne\bot\Leftrightarrow\\
\mathcal{X}\suprel{\bigsqcap^{\mathsf{FCD}}\up^{\Gamma(\Src f,\Dst f)}f}\mathcal{Y}\Leftrightarrow\mathcal{X}\suprel{\tofcd f}\mathcal{Y}.
\end{multline*}

({*}) by properties of generalized filter bases, taking into account
that funcoids are isomorphic to filters.

\item [{\ref{fcd-up-g-fcd}}] $\bigsqcap_{F\in\up^{\Gamma(\Src f,\Dst f)}f}^{\mathscr{F}}\supfun Fa=\left\langle \bigsqcap^{\mathsf{FCD}}\up^{\Gamma(\Src f,\Dst f)}f\right\rangle a=\supfun{\tofcd f}a$
for every ultrafilter $a$.

It remains to prove that the function
\[
\varphi=\lambda\mathcal{X}\in\mathscr{F}(\Src f):\bigsqcap_{F\in\up^{\Gamma(\Src f,\Dst f)}f}^{\mathscr{F}}\supfun F\mathcal{X}
\]
is a component of a funcoid (from what follows that $\varphi=\supfun{\tofcd f}$).
To prove this, it's enough to show that it preserves finite joins
and filtered meets.

$\varphi\bot=\bot$ is obvious. $\varphi(\mathcal{I}\sqcup\mathcal{J})=\bigsqcap_{F\in\up^{\Gamma(\Src f,\Dst f)}f}^{\mathscr{F}}(\supfun F\mathcal{I}\sqcup\supfun F\mathcal{J})=\bigsqcap_{F\in\up^{\Gamma(\Src f,\Dst f)}f}^{\mathscr{F}}\supfun F\mathcal{I}\sqcup\bigsqcap_{F\in\up^{\Gamma(\Src f,\Dst f)}f}^{\mathscr{F}}\supfun F\mathcal{J}=\varphi\mathcal{I}\sqcup\varphi\mathcal{J}$.
If $S$ is a generalized filter base of $\Src f$, then
\begin{multline*}
\varphi\bigsqcap^{\mathscr{F}}S=\bigsqcap_{F\in\up^{\Gamma(\Src f,\Dst f)}f}^{\mathscr{F}}\supfun F\bigsqcap^{\mathscr{F}}S=\bigsqcap_{F\in\up^{\Gamma(\Src f,\Dst f)}f}^{\mathscr{F}}\bigsqcap^{\mathscr{F}}\rsupfun{\supfun F}S=\\
\bigsqcap_{F\in\up^{\Gamma(\Src f,\Dst f)}f}^{\mathscr{F}}\bigsqcap_{\mathcal{X}\in S}^{\mathscr{F}}\supfun F\mathcal{X}=\bigsqcap_{\mathcal{X}\in S}^{\mathscr{F}}\bigsqcap_{F\in\up^{\Gamma(\Src f,\Dst f)}f}^{\mathscr{F}}\supfun F\mathcal{X}=\bigsqcap_{\mathcal{X}\in S}^{\mathscr{F}}\varphi\mathcal{X}=\bigsqcap^{\mathscr{F}}\rsupfun{\varphi}S.
\end{multline*}

So $\varphi$ is a component of a funcoid.

\end{widedisorder}
\end{proof}
\begin{defn}
$\boxbox f=\bigsqcap^{\mathsf{RLD}}\up^{\Gamma(\Src f,\Dst f)}f$
for reloid $f$.\end{defn}
\begin{conjecture}
$\boxbox f=\torldin \tofcd f$ for every reloid $f$.
\end{conjecture}
\begin{obvious}
$\boxbox f\sqsupseteq f$ for every reloid $f$.\end{obvious}
\begin{example}
$\torldin f\neq\boxbox\torldout f$ for some funcoid
$f$.\end{example}
\begin{proof}
Take $f=\id_{\Omega(\mathbb{N})}^{\mathsf{FCD}}$. Then, as it was
shown above, $\torldout f=\bot$ and thus $\boxbox\torldout f=\bot$.
But $\torldin f\sqsupseteq\torldin f\neq\bot$. So $\torldin f\neq\boxbox\torldout f$.\end{proof}
Another proof of the theorem ``$\dom\torldin f=\dom f$ and $\im\torldin f=\im f$
for every funcoid $f$.'':
\begin{proof}
We have for every filter $\mathcal{X}\in\mathscr{F}(\Src f)$:
\begin{multline*}
\mathcal{X}\sqsupseteq\dom\torldin f\Leftrightarrow\mathcal{X}\times^{\mathsf{RLD}}\top\sqsupseteq\torldin f\Leftrightarrow\\
\forall a\in\mathscr{F}(\Src f),b\in\mathscr{F}(\Dst f):(a\times^{\mathsf{FCD}}b\sqsubseteq f\Rightarrow a\times^{\mathsf{RLD}}b\sqsubseteq\mathcal{X}\times^{\mathsf{RLD}}\top)\Leftrightarrow\\
\forall a\in\mathscr{F}(\Src f),b\in\mathscr{F}(\Dst f):(a\times^{\mathsf{FCD}}b\sqsubseteq f\Rightarrow a\sqsubseteq\mathcal{X})
\end{multline*}
and
\begin{multline*}
\mathcal{X}\sqsupseteq\dom f\Leftrightarrow\mathcal{X}\times^{\mathsf{FCD}}\top\sqsupseteq f\Leftrightarrow\\
\forall a\in\mathscr{F}(\Src f),b\in\mathscr{F}(\Dst f):(a\times^{\mathsf{FCD}}b\sqsubseteq f\Rightarrow a\times^{\mathsf{FCD}}b\sqsubseteq\mathcal{X}\times^{\mathsf{FCD}}\top)\Leftrightarrow\\
\forall a\in\mathscr{F}(\Src f),b\in\mathscr{F}(\Dst f):(a\times^{\mathsf{FCD}}b\sqsubseteq f\Rightarrow a\sqsubseteq\mathcal{X}).
\end{multline*}

Thus $\dom\torldin f=\dom f$. The rest follows from symmetry.\end{proof}

Another proof that
$\dom\torldin f=\dom f$ and $\im\torldin f=\im f$ for every funcoid $f$:
\begin{proof}
$\dom\torldin f\sqsupseteq\dom f$ and $\im\torldin f\sqsupseteq\im f$
because $\torldin f\sqsupseteq\torldin$ and $\dom\torldin f=\dom f$
and $\im\torldin f=\im f$.

It remains to prove (as the rest follows from symmetry) that $\dom\torldin f\sqsubseteq\dom f$.

Really,
\begin{multline*}
\dom\torldin f\sqsubseteq\bigsqcap^{\mathscr{F}}\setcond{X\in\up\dom f}{X\times\top\in\up f}=\\
\bigsqcap^{\mathscr{F}}\setcond{X\in\up\dom f}{X\in\up\dom f}=\bigsqcap^{\mathscr{F}}\up\dom f=\dom f.
\end{multline*}
\end{proof}

\section{More on properties of funcoids}
\begin{prop}
$\Gamma(A,B)$ is the center of lattice $\mathsf{FCD}(A,B)$.\end{prop}
\begin{proof}
Theorem~\ref{pow-filt-central}.\end{proof}
\begin{prop}
$\up^{\Gamma(A,B)}(\mathcal{A}\times^{\mathsf{FCD}}\mathcal{B})$
is defined by the filter base $\setcond{A\times B}{A\in\up\mathcal{A},B\in\up\mathcal{B}}$
on the lattice $\Gamma(A,B)$.\end{prop}
\begin{proof}
It follows from the fact that $\mathcal{A}\times^{\mathsf{FCD}}\mathcal{B}=\bigsqcap^{\mathsf{FCD}}\setcond{A\times B}{A\in\up\mathcal{A},B\in\up\mathcal{B}}$.\end{proof}
\begin{prop}
$\up^{\Gamma(A,B)}(\mathcal{A}\times^{\mathsf{FCD}}\mathcal{B})=\mathfrak{F}(\Gamma(A,B))\cap\up(\mathcal{A}\times^{\mathsf{RLD}}\mathcal{B})$.\end{prop}
\begin{proof}
It follows from the fact that $\mathcal{A}\times^{\mathsf{FCD}}\mathcal{B}=\bigsqcap^{\mathsf{FCD}}\setcond{A\times B}{A\in\up\mathcal{A},B\in\up\mathcal{B}}$.\end{proof}
\begin{prop}
For every $f\in\mathfrak{F}(\Gamma(A,B))$:
\begin{enumerate}
\item \label{gamma-ff}$f\circ f$ is defined by the filter base $\setcond{F\circ F}{F\in\up f}$
(if $A=B$);
\item \label{gamma-f1f}$f^{-1}\circ f$ is defined by the filter base $\setcond{F^{-1}\circ F}{F\in\up f}$;
\item \label{gamma-ff1}$f\circ f^{-1}$ is defined by the filter base $\setcond{F\circ F^{-1}}{F\in\up f}$.
\end{enumerate}
\end{prop}
\begin{proof}
I will prove only \ref{gamma-ff} and \ref{gamma-f1f} because \ref{gamma-ff1}
is analogous to~\ref{gamma-f1f}.
\begin{widedisorder}
\item [{\ref{gamma-ff}}] It's enough to show that $\forall F,G\in\up f\exists H\in\up f:H\circ H\sqsubseteq G\circ F$.
To prove it take $H=F\sqcap G$.
\item [{\ref{gamma-f1f}}] It's enough to show that $\forall F,G\in\up f\exists H\in\up f:H^{-1}\circ H\sqsubseteq G^{-1}\circ F$.
To prove it take $H=F\sqcap G$. Then $H^{-1}\circ H=(F\sqcap G)^{-1}\circ(F\sqcap G)\sqsubseteq G^{-1}\circ F$.
\end{widedisorder}
\end{proof}
\begin{thm}
For every sets $A$, $B$, $C$ if $g,h\in\mathfrak{F}\Gamma(A,B)$
then
\begin{enumerate}
\item $f\circ(g\sqcup h)=f\circ g\sqcup f\circ h$;
\item $(g\sqcup h)\circ f=g\circ f\sqcup h\circ f$.
\end{enumerate}
\end{thm}
\begin{proof}
It follows from the order isomorphism above, which preserves composition.\end{proof}
\begin{thm}
$f\cap g=f\sqcap^{\mathsf{FCD}}g$ if $f,g\in\Gamma(A,B)$.\end{thm}
\begin{proof}
Let $f=X_{0}\times Y_{0}\cup\ldots\cup X_{n}\times Y_{n}$ and $g=X'_{0}\times Y'_{0}\cup\ldots\cup X'_{m}\times Y'_{m}$.

Then
\begin{multline*}
f\cap g=\bigcup_{i=0,\ldots,n,j=0,\ldots,m}((X_{i}\times Y_{i})\cap(X'_{j}\times Y'_{j}))=\\
\bigcup_{i=0,\ldots,n,j=0,\ldots,m}((X_{i}\cap X'_{j})\times(Y_{i}\cap Y'_{j})).
\end{multline*}

But $f=X_{0}\times Y_{0}\sqcup^{\mathsf{FCD}}\ldots\sqcup^{\mathsf{FCD}}X_{n}\times Y_{n}$
and $g=X'_{0}\times Y'_{0}\sqcup^{\mathsf{FCD}}\ldots\sqcup^{\mathsf{FCD}}X'_{m}\times Y'_{m}$;

\begin{multline*}
f\sqcap^{\mathsf{FCD}}g=\bigsqcup_{i=0,\ldots,n,j=0,\ldots,m}((X_{i}\times Y_{i})\sqcap^{\mathsf{FCD}}(X'_{j}\times Y'_{j}))=\\
\bigsqcup_{i=0,\ldots,n,j=0,\ldots,m}((X_{i}\sqcap X'_{j})\times^{\mathsf{FCD}}(Y_{i}\sqcap Y'_{j})).
\end{multline*}

\begin{cor}
If $X$ and $Y$ are finite binary relations, then
\begin{enumerate}
  \item $X \sqcap^{\mathsf{FCD}} Y = X \sqcap Y$;
  \item $(\top \setminus X) \sqcap^{\mathsf{FCD}} (\top \setminus Y) =
  (\top \setminus X) \sqcap (\top \setminus Y)$;
  \item $X \sqcap^{\mathsf{FCD}} (\top \setminus Y) = X \sqcap (\top
  \setminus Y)$.
\end{enumerate}
\end{cor}

Now it's obvious that $f\cap g=f\sqcap^{\mathsf{FCD}}g$.\end{proof}
\begin{thm}
The set of funcoids (from a given set~$A$ to a given set~$B$)
is with separable core.\end{thm}
\begin{proof}
Let $f,g\in\mathsf{FCD}(A,B)$ (for some sets~$A$,$B$).

Because filters on distributive lattices are with separable core,
there exist $F,G\in\Gamma(A,B)$ such that $F\cap G=\emptyset$. Then
by the previous theorem $F\sqcap^{\mathsf{FCD}}G=\bot$.\end{proof}
\begin{thm}
The coatoms of funcoids from a set~$A$ to a set~$B$ are exactly
$(A\times B)\setminus(\{x\}\times\{y\})$ for $x\in A$, $y\in B$.\end{thm}
\begin{proof}
That coatoms of $\Gamma(A,B)$
are exactly $(A\times B)\setminus(\{x\}\times\{y\})$ for $x\in A$,
$y\in B$, is obvious. To show that coatoms of funcoids are the same,
it remains to apply proposition~\ref{coat}.\end{proof}
\begin{thm}
The set of funcoids (for given~$A$ and~$B$) is coatomic.\end{thm}
\begin{proof}
Proposition~\ref{coat-ic}.\end{proof}
\begin{xca}
Prove that in general funcoids are not coatomistic.\end{xca}

\section{Funcoid bases}

This section will present mainly a counter-example against a statement you have not thought about anyway.

\begin{lem}
If $S$ is an upper set of principal funcoids, then
$\bigsqcap^{\mathsf{FCD}} (S\cap\Gamma)=\bigsqcap^{\mathsf{FCD}} S$.
\end{lem}

\begin{proof}
  $\bigsqcap^{\mathsf{FCD}} (S\cap\Gamma) \sqsupseteq \bigsqcap^{\mathsf{FCD}} S$ is obvious.

  $\bigsqcap^{\mathsf{FCD}} S = \bigsqcap^{\mathsf{FCD}} \bigsqcap^{\mathsf{FCD}}_{K\in S} T_K \sqsupseteq \bigsqcap^{\mathsf{FCD}} (S\cap\Gamma)$.
  where $T_K\in\subsets (S\cap\Gamma)$.
  So $\bigsqcap^{\mathsf{FCD}} (S\cap\Gamma) = \bigsqcap^{\mathsf{FCD}} S$.
\end{proof}

\begin{thm}
  If $S$ is a filter base on the set of binary relations then $S$ is a base of
  $\bigsqcap^{\mathsf{FCD}} S$.
\end{thm}

First prove a special case of our theorem to get the idea:

\begin{example}
  Take the filter base $S = \setcond{
  \setcond{ (x, y) }{ | x - y | < \varepsilon }}{ \varepsilon > 0 }$ and $K = \setcond{ (x, y) }{
  | x - y | < \exp x }$ where $x$ and $y$ range real
  numbers. Then $K \notin \up \bigsqcap^{\mathsf{FCD}} S$.
\end{example}

\begin{proof}
  Take a nontrivial ultrafilter $x$ on $\mathbb{R}$. We can for simplicity
  assume $x \sqsubseteq \mathbb{Z}$.

  \[ \supfun{\bigsqcap^{\mathsf{FCD}} S} x =
  \bigsqcap^{\mathscr{F}}_{L \in S} \supfun{L} x =
  \bigsqcap^{\mathscr{F}}_{L \in S, X \in \up x} \rsupfun{L} X =
  \bigsqcap^{\mathscr{F}}_{\varepsilon > 0, X \in \up
  x} \bigsqcup_{\alpha \in X} \mathopen] \alpha - \varepsilon ; \alpha + \varepsilon \mathclose[. \]

  $\supfun{K} x = \bigsqcap^{\mathscr{F}}_{X \in \up x} \rsupfun{K} X =
  \bigsqcap^{\mathscr{F}}_{X \in \up x}
  \bigsqcup_{\alpha \in X}\mathopen] \alpha - \exp \alpha ; \alpha + \exp \alpha \mathclose[$.

  Suppose for the contrary that $\supfun{K} x \sqsupseteq \supfun{
  \bigsqcap^{\mathsf{FCD}} S } x$.

  Then

  $\bigsqcup_{\alpha \in X} \mathopen] \alpha - \exp \alpha ; \alpha + \exp \alpha \mathclose[
  \sqsupseteq \bigsqcap^{\mathscr{F}}_{\varepsilon > 0, X \in \up x}
  \bigsqcup_{\alpha \in X} \mathopen] \alpha - \varepsilon ; \alpha + \varepsilon \mathclose[$ for
  every $X \in \up x$;

  thus by properties of generalized filter bases ($\setcond{ \bigsqcup_{\alpha
  \in X} \mathopen] \alpha - \varepsilon ; \alpha + \varepsilon \mathclose[ }{
  \varepsilon > 0 }$ is a filter base and even a chain)

  $\bigsqcup_{\alpha \in X} \mathopen] \alpha - \exp \alpha ; \alpha + \exp \alpha \mathclose[
  \sqsupseteq \bigsqcap^{\mathscr{F}}_{X \in \up x} \bigsqcup_{\alpha
  \in X} \mathopen] \alpha - \varepsilon ; \alpha + \varepsilon \mathclose[$ for some $\varepsilon
  > 0$ and thus
  by properties of generalized filter bases ($\setcond{ \bigsqcup_{\alpha \in
  X} \mathopen] \alpha - \varepsilon ; \alpha + \varepsilon \mathclose[ }{
  X \in \up x }$ is a filter base) for some $X' \in \up x$

  \[ \bigsqcup_{\alpha \in X} \mathopen] \alpha - \exp \alpha ; \alpha + \exp \alpha \mathclose[
  \sqsupseteq \bigsqcup_{\alpha \in X'} \mathopen] \alpha - \varepsilon ; \alpha +
  \varepsilon \mathclose[ \]
  what is impossible by the fact that $\exp \alpha$ goes infinitely small as
  $\alpha \rightarrow - \infty$ and the fact that we can take $X =\mathbb{Z}$
  for some $x$.
\end{proof}

Now prove the general case:

\begin{proof}
  Suppose that $K \in \up \bigsqcap^{\mathsf{FCD}} S$ and thus
  $\supfun{K} x \sqsupseteq \supfun{
  \bigsqcap^{\mathsf{FCD}} S } x$.
  We need to prove that there is some~$L\in S$ such that $K\sqsupseteq L$.

  Take an ultrafilter $x$.

  $\supfun{\bigsqcap^{\mathsf{FCD}} S} x =
  \bigsqcap^{\mathscr{F}}_{L \in S} \supfun{L} x =
  \bigsqcap^{\mathscr{F}}_{L \in S, X \in \up x} \rsupfun{L} X$.

  $\supfun{K} x = \bigsqcap^{\mathscr{F}}_{X \in \up x} \rsupfun{K}X$.

  Then
  $\rsupfun{K} X \sqsupseteq \bigsqcap^{\mathscr{F}}_{L \in S, X
  \in \up x} \rsupfun{L} X$ for every $X \in \up x$;
  thus by properties of generalized filter bases ($\setcond{ \rsupfun{L}X
  }{ L \in S }$ is a filter base);

  $\rsupfun{K} X \sqsupseteq \bigsqcap^{\mathscr{F}}_{X \in
  \up x} \rsupfun{L} X$ for some $L \in S$ and thus
  by properties of generalized filter bases ($\setcond{ \rsupfun{L}
  X }{ X \in \up x }$ is a filter base) for some $X' \in \up x$

  $\rsupfun{K} X \sqsupseteq \rsupfun{L} X'
  \sqsupseteq \supfun{L} x$.

  So $\supfun{K} x \sqsupseteq \supfun{L} x$ because this
  equality holds for every $X \in \up x$. Therefore $K \sqsupseteq L$.
\end{proof}

\begin{example}
A base of a funcoid which is not a filter base.
\end{example}

\begin{proof}
Consider $f=\id^{\mathsf{FCD}}_{\Omega}$. We know that $\up f$ is not a
filter base. But it is a base of a funcoid.
\end{proof}

\begin{xca}
Prove that a set $S$ is a filter (on some set) iff
\[ \forall X_0,\dots,X_n\in S:\up(X_0\sqcap\dots\sqcap X_n)\subseteq S \]
for every natural~$n$.
\end{xca}

A similar statement does \emph{not} hold for funcoids:

\begin{example}
For a set $S$ of binary relations
\[ \forall X_0,\dots,X_n\in S:\up(X_0\sqcap^{\mathsf{FCD}}\dots\sqcap^{\mathsf{FCD}} X_n)\subseteq S \]
does not imply that there exists funcoid~$f$ such that $S=\up f$.
\end{example}

\begin{proof}
Take $S_0 = \up 1^{\mathsf{FCD}}$ (where $1^{\mathsf{FCD}}$ is the identity funcoid on any infinite set)
and $S_1 = \bigcup_{F\in S_0} \setcond{\up G}{G\in\up^{\Gamma} F}$ (that is
$S_1 = \bigcup_{F\in\up^{\Gamma} 1^{\mathsf{FCD}}}\up F$).

Both $S_0$ and $S_1$ are upper sets. $S_0\ne S_1$ because $1^{\mathsf{FCD}}\in S_0$ and $1^{\mathsf{FCD}}\notin S_1$.

The formula in the example works for $S=S_0$ because $X_0,\dots,X_n\in \up 1^{\mathsf{FCD}}$. It also holds for $S=S_1$ by the
following reason:

Suppose $X_0,\dots,X_n\in S_1$. Then $X_i\sqsupseteq F_i$ where $F_i\in S_0$.
Consequently (take into account that $\Gamma$ is a sublattice of $\mathsf{FCD}$)
$X_0,\dots,X_n \sqsupseteq F_0\sqcap^{\mathsf{FCD}}\dots\sqcap^{\mathsf{FCD}} F_n$ and so
$X_0\sqcap^{\mathsf{FCD}}\dots\sqcap^{\mathsf{FCD}} X_n=
X_0\sqcap\dots\sqcap X_n \sqsupseteq F_0\sqcap^{\mathsf{FCD}}\dots\sqcap^{\mathsf{FCD}} F_n \sqsupseteq 1^{\mathsf{FCD}}$.
Thus $X_0\sqcap\dots\sqcap X_n \in \up^{\Gamma} 1^{\mathsf{FCD}} \subseteq S_1$;
$\up(X_0\sqcap\dots\sqcap X_n)\subseteq S_1$ as $S_1$ is an upper set.

To finish the proof suppose for the contrary that $\up f_0=S_0$ and $\up f_1=S_1$ for some funcoids~$f_0$ and~$f_1$.
In this case $f_0=\bigsqcap^{\mathsf{FCD}} S_0 = 1^{\mathsf{FCD}} = \bigsqcap^{\mathsf{FCD}} \up^{\Gamma} 1^{\mathsf{FCD}} =
\bigsqcap^{\mathsf{FCD}} S_1 = f_1$ and thus $S_0=S_1$, contradiction.
\end{proof}

\begin{prop}
For a set $S$ of binary relations
\[ \forall X_0,\dots,X_n\in S:\up(X_0\sqcap^{\mathsf{FCD}}\dots\sqcap^{\mathsf{FCD}} X_n)\subseteq S \]
does not imply that~$S$ is a funcoid base.
\end{prop}

\begin{proof}
Suppose for the contrary that it does imply. Then, because~$S$ is an upper set (as follows from the condition,
taking $n=0$), it implies that~$S=\up f$ for a funcoid~$f$, what contradicts to the above example.
\end{proof}

\begin{conjecture}
  Let $\forall X,Y\in S:\up(X\sqcap^{\mathsf{FCD}} Y)\subseteq S$.

  Then
  \[ \forall X_0,\dots,X_n\in S:\up(X_0\sqcap^{\mathsf{FCD}}\dots\sqcap^{\mathsf{FCD}} X_n)\subseteq S. \]
\end{conjecture}

\begin{xca}
$\up (f_0 \sqcap^{\mathsf{FCD}} \ldots
\sqcap^{\mathsf{FCD}} f_n) \subseteq \setcond{ F_0 \sqcap \ldots \sqcap
F_n }{ F_0 \in \up f_0 \wedge \ldots \wedge F_n \in \up f_n }$ for every funcoids~$f_0$, \dots, $f_n$ ($n\in\mathbb{N}$).
\end{xca}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Some (example) values}

I will do some calculations of particular funcoids and reloids.

First note that $\sqcap^{\mathsf{FCD}}$ can be decomposed (see below for a short easy proof):
\[ f \sqcap^{\mathsf{FCD}} g = \tofcd ((\torldin f \sqcap \torldin g). \]

The above is a more understandable decomposition of the operation~$\sqcap^{\mathsf{FCD}}$
which behaves in strange way, mapping meet of two binary relations into a funcoid which
is not a binary relation ($1^{\mathsf{FCD}} \sqcap^{\mathsf{FCD}} (\top \setminus 1^{\mathsf{FCD}}) =
1^{\mathsf{FCD}}_{\Omega}$).

The last formula is easy to prove (and proved above in the book) but the result is counter-intuitive.

More generally:
\[ \bigsqcap^{\mathsf{FCD}} S = \tofcd \bigsqcap^{\mathsf{RLD}} \rsupfun{\torldin} S. \]

The above formulas follow from the fact that~$\tofcd$ is an upper adjoint
and that $\tofcd\torldin f=f$ for every funcoid $f$.

Let $\mathsf{FCD}$ denote funcoids on a set $U$.

Consider a special case of the above formulas:
\begin{equation}\label{fcd-meet-spec}
1^{\mathsf{FCD}} \sqcap^{\mathsf{FCD}} (\top \setminus 1^{\mathsf{FCD}}) =
\tofcd (\torldin 1^{\mathsf{FCD}} \sqcap \torldin (\top \setminus 1^{\mathsf{FCD}})).
\end{equation}

We want to calculate terms of the formula~\eqref{fcd-meet-spec} and more generally do some
(probably useless) calculations for particular funcoids and reloids related to the above formula.

The left side is already calculated. The term~$\torldin 1^{\mathsf{FCD}}$ which I call
``thick equality'' above is well understood. Let's compute $\torldin (\top \setminus 1^{\mathsf{FCD}})$.

\begin{prop}
$\torldin (\top \setminus 1^{\mathsf{FCD}}) = \top \setminus 1^{\mathsf{FCD}}$.
\end{prop}

\begin{proof}
Consider funcoids on a set $U$. For any filters~$x$ and~$y$ (or without loss of generality ultrafilters~$x$ and~$y$) we have:

\begin{multline*}
x \times^{\mathsf{FCD}} y \sqsubseteq \top \setminus
1^{\mathsf{FCD}} \Leftrightarrow \\ \text{(theorem 574 and the fact that
funcoids are filters)} \Leftrightarrow \\ x \times^{\mathsf{FCD}} y \asymp
1^{\mathsf{FCD}} \Leftrightarrow \neg \left( x
\mathrel{[1^{\mathsf{FCD}}]} y \right) \Leftrightarrow x \asymp y
\Rightarrow \\ \exists X \in \up x, Y \in \up y : X \asymp Y.
\end{multline*}

Thus $\torldin (\top \setminus
1^{\mathsf{FCD}}) = \bigsqcup \setcond{ X \times Y}
{X, Y \in \mathscr{T} U, X \asymp Y } = \top \setminus
1^{\mathsf{FCD}}$.
\end{proof}

So, we have:

\[
1^{\mathsf{FCD}}_{\Omega} =
1^{\mathsf{FCD}} \sqcap^{\mathsf{FCD}} (\top \setminus 1^{\mathsf{FCD}}) =
\torldin 1^{\mathsf{FCD}} \sqcap^{\mathsf{FCD}} (\top \setminus 1^{\mathsf{FCD}}).
\]

\begin{prop}\label{cj-rldin-diag}
  If $X_0 \sqcup \ldots \sqcup X_n = \top$ then $(X_0 \times X_0) \sqcup
  \ldots \sqcup (X_n \times X_n) \in \up
  \torldin 1^{\mathsf{FCD}}$.
\end{prop}

\begin{proof}
  It's enough to prove $(X_0 \times X_0) \sqcup \ldots \sqcup (X_n \times X_n)
  \in \up (x \times x)$ for every ultrafilter~$x$, what follows from the
  fact that $x \sqsubseteq X_i$ for some~$i$ and thus $x \times x \sqsubseteq
  X_i \times X_i$.
\end{proof}

\begin{prop}
  For finite tuples $X$, $Y$ of typed sets
  \[ (X_0 \times Y_0) \sqcup \ldots \sqcup (X_n \times Y_n) \sqsupseteq 1
     \Leftrightarrow (X_0 \sqcap Y_0) \sqcup \ldots \sqcup (X_n \sqcap Y_n) =
     \top . \]
\end{prop}

\begin{proof}
\begin{multline*}
  (X_0 \times Y_0) \sqcup \ldots \sqcup (X_n \times Y_n) \sqsupseteq 1
  \Leftrightarrow \\ ((X_0 \times Y_0) \sqcup \ldots \sqcup (X_n \times Y_n))
  \sqcap 1 = 1 \Leftrightarrow \\ ((X_0 \times Y_0) \sqcap 1) \sqcup \ldots
  \sqcup ((X_n \times Y_n) \sqcap 1) = 1 \Leftrightarrow \\ \id_{X_0 \sqcap
  Y_0} \sqcup \ldots \sqcup \id_{X_n \sqcap Y_n} = 1 \Leftrightarrow \\
  \id_{(X_0 \sqcap Y_0) \sqcup \ldots \sqcup (X_n \sqcap Y_n)} = 1
  \Leftrightarrow \\ (X_0 \sqcap Y_0) \sqcup \ldots \sqcup (X_n \sqcap Y_n) =
  \top.
\end{multline*}
\end{proof}

\begin{cor}
  ~
  \[ \up^{\Gamma} 1 = \setcond{ (X_0 \times Y_0) \sqcup \ldots \sqcup (X_n
     \times Y_n) }{ n \in \mathbb{N}, \forall i \in
     n : X_i, Y_i \in \mathscr{T} U, (X_0 \sqcap Y_0) \sqcup \ldots \sqcup
     (X_n \sqcap Y_n) = \top } . \]
\end{cor}

\begin{cor}
  The predicate
  $(X_0 \sqcap Y_0) \sqcup \ldots \sqcup (X_n \sqcap Y_n) = \top$ for an
  element $(X_0 \times Y_0) \sqcup \ldots \sqcup (X_n \times Y_n)$ of $\Gamma$
  does not depend on its representation $(X_0 \times Y_0) \sqcup \ldots \sqcup
  (X_n \times Y_n)$.
\end{cor}

\begin{prop}
  ~
  \[ \up^{\Gamma} 1 = \bigcup \setcond{ \up^{\Gamma} ((X_0 \times
     X_0) \sqcup \ldots \sqcup (X_n \times X_n)) }{ n
     \in \mathbb{N}, \forall i \in n : X_i \in \mathscr{T} U, X_0 \sqcup
     \ldots \sqcup X_n = \top } . \]
\end{prop}

\begin{proof}
  If $(X_0 \times Y_0) \sqcup \ldots \sqcup (X_n \times Y_n) \in
  \up^{\Gamma} 1$ then we have
\begin{multline*}
  (X_0 \times Y_0) \sqcup \ldots \sqcup (X_n \times Y_n) \sqsupseteq \\ ((X_0
     \sqcap Y_0) \times (X_0 \sqcap Y_0)) \sqcup \ldots \sqcup ((X_n \sqcap
     Y_n) \times (X_n \sqcap Y_n)) \in \up^{\Gamma} 1.
\end{multline*}
  Thus
  \[ \up^{\Gamma} 1 \subseteq \bigcup \setcond{ \up^{\Gamma} ((X_0
     \times X_0) \sqcup \ldots \sqcup (X_n \times X_n)) }{
     \hspace{1em} n \in \mathbb{N}, \forall i \in n : X_i \in \mathscr{T} U,
     X_0 \sqcup \ldots \sqcup X_n = \top } . \]
  The reverse inclusion is obvious.
\end{proof}

\begin{prop}
  ~
  \[ \torldin 1^{\mathsf{FCD}} =
     \bigsqcap^{\mathsf{RLD}} \setcond{ (X_0 \times X_0) \sqcup \ldots
     \sqcup (X_n \times X_n) }{ n \in \mathbb{N},
     \forall i \in n : X_i \in \mathscr{T} U, X_0 \sqcup \ldots \sqcup X_n =
     \top } . \]
\end{prop}

\begin{proof}
  By the diagram we have $\torldin
  1^{\mathsf{FCD}} = \bigsqcap^{\mathsf{RLD}} \up^{\Gamma} 1$. So it follows from the previous proposition.
\end{proof}

\begin{prop}
  $\up^{\Gamma} \torldin 1^{\mathsf{FCD}} = \up^{\Gamma} 1$.
\end{prop}

\begin{proof}
  If $K \in \up^{\Gamma} 1$ then $K \in \up^{\Gamma} ((X_0 \times
  X_0) \sqcup \ldots \sqcup (X_n \times X_n))$ and thus $K \in
  \up^{\Gamma}  \torldin
  1^{\mathsf{FCD}}$ (see proposition~\ref{cj-rldin-diag}). Thus $\up^{\Gamma}
  1 \subseteq \up^{\Gamma}  \torldin
  1^{\mathsf{FCD}}$. But $\up^{\Gamma}
  \torldin 1^{\mathsf{FCD}} \subseteq
  \up^{\Gamma} 1$ is obvious.
\end{proof}


\subsubsection{\stid{3.14} ALExa}

\paragraph{Overview}

The ALExa project ({\sl Accelerated Libraries for Exascale}) focuses on
preparing the ArborX, DTK, Tasmanian, and ForTrilinos libraries for exascale
platforms and integrating these libraries into ECP applications.
These libraries deliver capabilities identified as needs of ECP applications:
%
(1) the ability the perform performance portable spatial searches between
arbitrary sets of distributed geometric objects (ArborX);
%
(2) the ability to transfer computed
solutions between grids with differing layouts on parallel accelerated
architectures, enabling multiphysics projects to seamlessly combine results
from different computational grids to perform their required simulations
(DTK); and
%
(3) the ability to construct fast and memory efficient surrogates to
large-scale engineering models with multiple inputs and many outputs,
enabling uncertainty quantification (both forward and inverse) as well as
optimization and efficient multi-physics simulations in projects such as
ExaStar (Tasmanian); and
%
(4) the ability to automatically interface Fortran-based codes to existing
large and complex C/C++ solftware libraries, such as Trilinos advanced solvers
that can utilize next-generation platforms.

These capabilities are being developed through ongoing interactions with our
ECP application project collaborators to ensure they will satisfy requirements
of these customers.  The libraries in turn take advantage of other ECP/SW
capabilities currently in development, including Trilinos,
Kokkos, and SLATE.  The final outcome of the ECP project will be a set of
libraries deployed to facilities and also made broadly available as part of
the xSDK4ECP project.

{\bf ArborX}

{\it Purpose:} ArborX is an open-source library designed to provide
performance portable algorithms for geometric search.

{\it Significance:} General geometric search capabilities are needed in a wide
variety of applications, including the generation of neighbor lists in
particle-based applications (e.g., molecular dynamics or general N-body
dynamics simulations), density-based clustering analysis (e.g., halo finding
or DBSCAN in cosmology) and mesh-mesh interactions such as contact in
computational mechanics and solution transfer in multiphysics simulations.

{\it Performance portable search capabilities:} Shared memory and GPU
implementations of spatial tree construction; shared memory and GPU
implementations of various spatial tree queries; MPI front-end for
coordinating distributed spatial searches between sets of geometric objects
with different decompositions; communication plan generation based on spatial
search results; density-based clustering algorithms (DBSCAN).

{\it URL:} https://github.com/arborx/ArborX

{\bf DTK} (Data Transfer Kit)

{\it Purpose:} Transfers computed solutions between grids with differing
layouts on parallel accelerated architectures.

{\it Significance:} Coupled applications frequently have different grids with
different parallel distributions; DTK is able to transfer solution values
between these grids efficiently and accurately.

{\it Mesh and mesh-free interpolation capabilities:} multivariate data
interpolation between point clouds and grids; compactly supported radial basis
functions; nearest-neighbor and moving least square implementations; support
for standard finite-element shape functions and user-defined interpolants;
common applications include conjugate heat transfer, fluid structure
interaction, and mesh deformation.

{\it URL:} https://github.com/ORNL-CEES/DataTransferKit

{\bf Tasmanian} (Toolkit for Adaptive Stochastic Modeling and Non-Intrusive
Approximation)

{\it Purpose:} Constructs efficient surrogate models for high-dimensional
problems and performs parameter calibration and optimization geared towards
applications in uncertainty quantification (UQ).

{\it Significance:} UQ pertains to the statistical properties of the output
from a complex model with respect to variability in multiple model inputs;
large number of simulations are required to compute reliable statistics which
is prohibitive when dealing with computationally expensive engineering
models. A surrogate model is constructed from a moderate set of simulations
using carefully chosen input values; analysis can then be performed on the
efficient surrogate.

{\it Sparse grids capabilities:} surrogate modeling and design of experiments
(adaptive multi-dimensional interpolation); reduced (lossy) representation of
tabulated scientific data; high dimensional numerical quadrature; data mining
and manifold learning.

{\it DiffeRential Evolution Adaptive Metropolis (DREAM) capabilities:}
Bayesian inference; parameter estimation/calibration; model validation.
global optimization and optimization under uncertainty.

{\it URL:} http://tasmanian.ornl.gov

{\bf ForTrilinos} (Fortran Trilinos)

{\it Purpose:}
ForTrilinos provides a seamless pathway for large and complex Fortran-based
codes to access Trilinos without C/C++ interface code. This access includes
Fortran versions of Kokkos abstractions for code execution and data management.
To provide this functionality, this project developed a Fortran-targeted
extension to the SWIG (Simplified Wrapper and Interface Generator) tool.
Applied to Trilinos, it generates object-oriented Fortran 2003 interface code
that closely mirrors the Trilinos C++ API.

{\it Significance:}
The Exascale Computing Project (ECP) requires the successful transformation and
porting of many Fortran application codes in preparation for ECP platforms. A
significant number of these codes rely upon the scalable solution of linear and
nonlinear equations. The Trilinos Project contains a large and growing
collection of solver capabilities that can utilize next-generation platforms, in
particular scalable multicore, manycore, accelerator and heterogeneous systems.
Since Trilinos is written primarily in C++, its capabilities are not available
to other programming languages. ForTrilinos bridges the gap between the
needs of Fortran app developers and the capabilities of Trilinos. Furthermore,
the technology used to generate the Fortran--C++ bindings in ForTrilinos is
capable of exposing any number of C++ libraries to Fortran exascale app
developers.

{\it SWIG capabilities:}
ForTrilinos provides an inversion of control functionality that enables custom
extensions of the Trilinos solvers implemented in downstream Fortran apps.
Although this capability is not yet comprehensive, the goal of this project is
to provide functional and extensible access Trilinos on next-generation
computing systems. Several examples of ForTrilinos are being demonstrated within
Fortran-based ECP codes to help them meet simulation goals and illustrate the
technology to other Fortran-based ECP codes. Additionally, the SWIG technology
underpinning ForTrilinos is being applied to other C++-based ECP ST subprojects
to expose their capabilities to Fortran apps.

{\it URL:} https://github.com/trilinos/ForTrilinos

\paragraph{Key Challenges}

\indent

{\bf ArborX:} Search procedures to locate neighboring points, mesh cells, or
other geometric objects require tree search methods difficult to optimize on
modern accelerated architectures due to vector lane or thread divergence. A
flexible interface for calling user kernels on a positive match as well as
modifying traversal algorithms in a task-specific manner are crucial to
achieving the best performance.

{\bf DTK:} General data transfer between grids of unrelated applications
requires many-to-many communication which is increasingly challenging as
communication to computation ratios are decreasing on successive HPC systems.
Maintaining high accuracy for the transfer requires careful attention to the
mathematical properties of the interpolation methods and is highly
application-specific.

{\bf Tasmanian:} Extracting statistical information from a Tasmanian surrogate
(or using the surrogate in a multi-physics simulation) requires the collection
of a large number of samples, which is not feasible without GPU acceleration.
The GPU accelerated surrogate evaluations require both custom kernels
corresponding to the different types of basis functions as well as both
sparse and dense linear algebra methods (BLAS level 2 and 3).
Porting the capabilities and optimizing the performance across different
divergent architectures is challenging.

{\bf ForTrilinos:}
Developing the interfaces to the C++ libraries that provide access to
cutting-edge research, such as Trilinos,  is of significant benefit to Fortran
community. However, such interfaces must be well documented, sustainable and
extensible, which would require significant amount of resources and investment.
This is further complicated by the requirements to support heterogeneous
platforms (e.g., GPUs) and inversion-of-control functionality. The manual
approach to such interfaces has been shown to be unsustainable as it requires
interface developers to have in-depth expertise in  multiple languages and the
peculiarities in their interaction on top of the time commitment to update the
interfaces with changes in the library.

ForTrilinos addresses both the issue of reducing interface generation cost
through investment in tool configuration and usage to make the process as
automatic as possible, and the issue of providing the full-featured interface to
Trilinos library, including access to manycore, accelerator and heterogeneous
solver capabilities in Trilinos.

\paragraph{Solution Strategy}

\nobreak

\indent

{\bf ArborX:} ArborX builds on a MPI+Kokkos programming model to deploy to all
DOE HPC architectures. Extensive performance engineering has yielded
implementations that are both as performant in serial as state-of-the-art
libraries while also expanding on the capability provided by other libraries by
demonstrating thread scalability on both GPU and multi-core CPU architectures.
Working with both synthetic as well as real data from applications (e.g., HACC)
ensures wide performance testing coverage.

{\bf DTK:} State-of-the-art, mathematically rigorous methods are used in DTK
to preserve accuracy of interpolated solutions.  Algorithms are implemented in
a C++ code base with extensive unit testing on multiple platforms.  Trilinos
packages are used to support interpolation methods.  Kokkos is used to achieve
performance portability across accelerated platforms.

{\bf Tasmanian:} The C++ kernels within Tasmanian (currently tuned for Nvidia
Volta architecture) are templated exposing numerous performance tweaks and
tuning parameters that can be adjusted to perform well on a corresponding AMD
system.
The kernels also need to be ported to DPC++/SYCL to allow for the utilization
of Intel GPUs. Tasmanian requires a general GPU-BLAS interface that can
utilize any of the accelerated backends, e.g., cuBlas, rocBlas, MKL and MAGMA.

{\bf ForTrilinos:}
ForTrilinos defines several SWIG-Fortran modules that generate Fortran-2003
interfaces to C++ Trilinos solver classes. ForTrilinos provides a
``high-level'' interface for applications to access nonlinear and eigenvalue
solvers in addition to low-level Trilinos classes.

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

\paragraph{Recent Progress}

\indent

{\bf ArborX:} Collaboration with partner application ExaSky (WBS 2.2.3.02)
resulted in significant advances for the in-situ density-based clustering
algorithm (halo finding) using Nvidia GPUs.

\begin{figure}[htb]
        \centering \includegraphics[width=4.0in]{projects/2.3.3-MathLibs/2.3.3.14-ALExa-ForTrilinos/arborx_hacc_progress.png} \caption{\label{fig:arborx-hacc}
        ArborX progress on halo finding algorithm on Nvidia Volta. The baseline
        is a serial implementation of CosmoTools. Numbers indicate speedup
        compared to the baseline. The solid lines show improvements that were
        already merged. Dashed lines show improvements that are in active
        development. }
\end{figure}

{\bf DTK:} DTK's build system has been rewritten. DTK now depends on Trilinos
instead of being built as an external package. DTK is now a separate package in
spack. In the future this will allow a decoupling between Trilinos version and
DTK version. A new spline interpolation method has been added.

{\bf Tasmanian:} Work with partner application ExaStar (2.2.3.01) created a
reduced representation of neutrino opacities used by the Thornado simulation
software. The classical representation uses dense tables that do not fit in
GPU memory and lead to unnecessary and expensive data movement for each time-step.
The reduced representation by Tasmanian preserved the accuracy of the simulations
and dramatically reduces the memory footprint by removing redundancies
and exploiting smoothness in the data.

\begin{figure}[htb]
        \centering
        \includegraphics[width=2.5in]{projects/2.3.3-MathLibs/2.3.3.14-ALExa-ForTrilinos/tasmanian_exastar}
\caption{\label{fig:tasmanian-exastar}
		The resulting neutrino and antineutrino distributions in a deleptonization
		wave simulation using sparse grid opacities, which require only 6\% of
		the memory used in the dense approach, with relative $L^2$ error less than 1\%.}
\end{figure}

{\bf ForTrilinos:}
As with DTK, ForTrilinos now has an independent build system with Trilinos as a
dependency. This improves robustness of the build and makes ForTrilinos
available to app developers even if a system installation of Trilinos does not
enable Fortran. ForTrilinos is now independently available through the Spack
package manager. New ST libraries including Tasmanian have been wrapped with the
SWIG-Fortran utility.

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

\paragraph{Next Steps}

\indent

{\bf ArborX:} Incorporate non axis-aligned bounding volumes to accommodate
stretched inclined geometries such as those coming from wind turbine
simulations from ExaWind (WBS 2.2.2.01). Further improve performance of
density-based algorithms.

{\bf DTK:} Continue performance engineering campaign and deploy in a variety of
applications.

{\bf Tasmanian:} Port the surrogate evaluation kernels to AMD and Intel
GPUs and optimize the performance on the next generation architectures
(including next generation Nvidia GPUs).

{\bf ForTrilinos:} Extend ForTrilinos native Fortran interface documentation and
prioritize Fortran app customer needs. Integrate SWIG into ECP ST projects that
desire Fortran interfaces.

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


\documentclass[landscape,twocolumn,letterpaper,9pt,reqno]{article}\usepackage[]{graphicx}\usepackage[]{color}
%% maxwidth is the original width if it is less than linewidth
%% otherwise use linewidth (to make sure the graphics do not exceed the margin)
\makeatletter
\def\maxwidth{ %
  \ifdim\Gin@nat@width>\linewidth
    \linewidth
  \else
    \Gin@nat@width
  \fi
}
\makeatother

\definecolor{fgcolor}{rgb}{0.345, 0.345, 0.345}
\newcommand{\hlnum}[1]{\textcolor[rgb]{0.686,0.059,0.569}{#1}}%
\newcommand{\hlstr}[1]{\textcolor[rgb]{0.192,0.494,0.8}{#1}}%
\newcommand{\hlcom}[1]{\textcolor[rgb]{0.678,0.584,0.686}{\textit{#1}}}%
\newcommand{\hlopt}[1]{\textcolor[rgb]{0,0,0}{#1}}%
\newcommand{\hlstd}[1]{\textcolor[rgb]{0.345,0.345,0.345}{#1}}%
\newcommand{\hlkwa}[1]{\textcolor[rgb]{0.161,0.373,0.58}{\textbf{#1}}}%
\newcommand{\hlkwb}[1]{\textcolor[rgb]{0.69,0.353,0.396}{#1}}%
\newcommand{\hlkwc}[1]{\textcolor[rgb]{0.333,0.667,0.333}{#1}}%
\newcommand{\hlkwd}[1]{\textcolor[rgb]{0.737,0.353,0.396}{\textbf{#1}}}%
\let\hlipl\hlkwb

\usepackage{framed}
\makeatletter
\newenvironment{kframe}{%
 \def\at@end@of@kframe{}%
 \ifinner\ifhmode%
  \def\at@end@of@kframe{\end{minipage}}%
  \begin{minipage}{\columnwidth}%
 \fi\fi%
 \def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep
 \colorbox{shadecolor}{##1}\hskip-\fboxsep
     % There is no \\@totalrightmargin, so:
     \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
 \MakeFramed {\advance\hsize-\width
   \@totalleftmargin\z@ \linewidth\hsize
   \@setminipage}}%
 {\par\unskip\endMakeFramed%
 \at@end@of@kframe}
\makeatother

\definecolor{shadecolor}{rgb}{.97, .97, .97}
\definecolor{messagecolor}{rgb}{0, 0, 0}
\definecolor{warningcolor}{rgb}{1, 0, 1}
\definecolor{errorcolor}{rgb}{1, 0, 0}
\newenvironment{knitrout}{}{} % an empty environment to be redefined in TeX

\usepackage{alltt}

\usepackage{lscape,fancyhdr}

\usepackage{hyperref}

\pagestyle{fancy}

\usepackage{amsmath,epsfig,subfigure,amsthm,amsfonts,epsf,psfrag,rotating,setspace,bm}

\usepackage{verbatim,color} % Allow text colors}

\setlength{\oddsidemargin}{-0.4in}		% default=0in
\setlength\evensidemargin{-0.4in}

\setlength{\textwidth}{9.8in}		% default=9in

\setlength{\columnsep}{0.5in}		% default=10pt

\setlength{\columnseprule}{0pt}		% default=0pt (no line)

\setlength{\textheight}{7.0in}		% default=5.15in

\setlength{\topmargin}{-0.75in}		% default=0.20in

\setlength{\headsep}{0.25in}		% default=0.35in

\setlength{\parskip}{1.2ex}

\setlength{\parindent}{0mm}

\lhead{Course EPIB607: Regression handout 002}
\rhead{jh,sb \ \ \ v. 2018.11.08}
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\begin{document}

\section{Mean depth of the ocean}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}
\begin{alltt}
\hlkwd{head}\hlstd{(depths)}
\end{alltt}
\begin{verbatim}
##           X        lon       lat  alt water South
## 41995 41995  -87.21236 59.290367  190     1     0
## 11151 11151 -122.33034  5.554558 4167     1     0
## 43640 43640 -148.54790 36.237464 5447     1     0
## 8615   8615  -24.92364 21.625967 5063     1     0
## 8126   8126  177.18458 13.880370 5634     1     0
## 16548 16548   48.88215  3.229250 3691     1     0
\end{verbatim}
\begin{alltt}
\hlkwd{dim}\hlstd{(depths)}
\end{alltt}
\begin{verbatim}
## [1] 400   6
\end{verbatim}
\begin{alltt}
\hlstd{fit} \hlkwb{<-} \hlkwd{lm}\hlstd{(alt} \hlopt{~} \hlnum{1}\hlstd{,} \hlkwc{data} \hlstd{= depths)}
\hlkwd{summary}\hlstd{(fit)}
\end{alltt}
\begin{verbatim}
##
## Call:
## lm(formula = alt ~ 1, data = depths)
##
## Residuals:
##     Min      1Q  Median      3Q     Max
## -3681.5  -584.8   405.5  1197.2  2827.5
##
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept)  3683.52      78.71    46.8   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1574 on 399 degrees of freedom
\end{verbatim}

\end{knitrout}

\clearpage

\section{Mean depth of the ocean in northern and southern hemisphere}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}

{\centering \includegraphics[width=1\linewidth]{figure/unnamed-chunk-3-1}

}

\end{knitrout}

\begin{knitrout}\footnotesize
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}
\begin{alltt}
\hlstd{fit} \hlkwb{<-} \hlkwd{lm}\hlstd{(alt} \hlopt{~} \hlstd{South,} \hlkwc{data} \hlstd{= depths)}
\hlkwd{summary}\hlstd{(fit)}
\end{alltt}
\begin{verbatim}
##
## Call:
## lm(formula = alt ~ South, data = depths)
##
## Residuals:
##     Min      1Q  Median      3Q     Max
## -3722.0  -608.5   401.5  1200.4  2867.9
##
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept)  3643.08     111.42  32.698   <2e-16 ***
## South          80.88     157.56   0.513    0.608
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1576 on 398 degrees of freedom
## Multiple R-squared:  0.0006617,	Adjusted R-squared:  -0.001849
## F-statistic: 0.2635 on 1 and 398 DF,  p-value: 0.608
\end{verbatim}
\begin{alltt}
\hlkwd{t.test}\hlstd{(alt} \hlopt{~} \hlstd{South,} \hlkwc{data} \hlstd{= depths,} \hlkwc{var.equal} \hlstd{=} \hlnum{TRUE}\hlstd{)}
\end{alltt}
\begin{verbatim}
##
## 	Two Sample t-test
##
## data:  alt by South
## t = -0.51334, df = 398, p-value = 0.608
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -390.6487  228.8787
## sample estimates:
## mean in group 0 mean in group 1
##        3643.080        3723.965
\end{verbatim}

\end{knitrout}

\clearpage

\section{Ratio depth of the ocean in northern and southern hemisphere}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}
\begin{alltt}
\hlcom{# note: we are now using glm}
\hlstd{fit} \hlkwb{<-} \hlkwd{glm}\hlstd{(alt} \hlopt{~} \hlstd{South,} \hlkwc{data} \hlstd{= depths,} \hlkwc{family} \hlstd{=} \hlkwd{gaussian}\hlstd{(}\hlkwc{link}\hlstd{=log))}
\hlkwd{summary}\hlstd{(fit)}
\end{alltt}
\begin{verbatim}
##
## Call:
## glm(formula = alt ~ South, family = gaussian(link = log), data = depths)
##
## Deviance Residuals:
##     Min       1Q   Median       3Q      Max
## -3722.0   -608.5    401.5   1200.4   2867.9
##
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept)  8.20058    0.03058 268.144   <2e-16 ***
## South        0.02196    0.04278   0.513    0.608
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 2482673)
##
##     Null deviance: 988758010  on 399  degrees of freedom
## Residual deviance: 988103771  on 398  degrees of freedom
## AIC: 7029.1
##
## Number of Fisher Scoring iterations: 5
\end{verbatim}

\end{knitrout}

\clearpage

\section{Student drinking}

\begin{knitrout}\footnotesize
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}
\begin{alltt}
\hlstd{fit} \hlkwb{<-} \hlkwd{lm}\hlstd{(drinks} \hlopt{~} \hlstd{gender,} \hlkwc{data} \hlstd{= drinks)}
\hlkwd{summary}\hlstd{(fit)}
\end{alltt}
\begin{verbatim}
##
## Call:
## lm(formula = drinks ~ gender, data = drinks)
##
## Residuals:
##     Min      1Q  Median      3Q     Max
## -5.5185 -1.7947 -0.2947  1.4815  9.4815
##
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept)   4.2947     0.2837  15.138  < 2e-16 ***
## gender        2.2238     0.4182   5.318  3.2e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.765 on 174 degrees of freedom
## Multiple R-squared:  0.1398,	Adjusted R-squared:  0.1348
## F-statistic: 28.28 on 1 and 174 DF,  p-value: 3.197e-07
\end{verbatim}
\begin{alltt}
\hlstd{fit} \hlkwb{<-} \hlkwd{glm}\hlstd{(drinks} \hlopt{~} \hlstd{gender,} \hlkwc{data} \hlstd{= drinks,} \hlkwc{family} \hlstd{=} \hlkwd{gaussian}\hlstd{(}\hlkwc{link}\hlstd{=log))}
\hlkwd{summary}\hlstd{(fit)}
\end{alltt}
\begin{verbatim}
##
## Call:
## glm(formula = drinks ~ gender, family = gaussian(link = log),
##     data = drinks)
##
## Deviance Residuals:
##     Min       1Q   Median       3Q      Max
## -5.5185  -1.7947  -0.2947   1.4815   9.4815
##
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept)  1.45739    0.06606  22.062  < 2e-16 ***
## gender       0.41726    0.08115   5.142 7.27e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 7.646385)
##
##     Null deviance: 1546.7  on 175  degrees of freedom
## Residual deviance: 1330.5  on 174  degrees of freedom
## AIC: 861.48
##
## Number of Fisher Scoring iterations: 5
\end{verbatim}

\end{knitrout}

\end{document}


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

\chapter{Reheating}

\section{Radiation from the inflaton}

\marginpar{Monday\\ 2020-11-16, \\ compiled \\ \today}

This is what happens in the transition between the inflationary phase and the usual radiation-dominated epoch.

We will give a simplified treatment, which however captures the main characteristics of the model.

Consider the typical inflationary potential: flat at \(\varphi \sim 0\), sloping down towards a minimum. At \(\varphi \sim \varphi _f\) the field starts ``falling down'' towards the minimum quickly.
The condition is \(V''(\varphi ) \gtrsim H^2\), meaning that \(\eta _V \gtrsim 1\), which also implies that quickly we will find \(\epsilon \gtrsim 1\).

When the field falls down it will \textbf{oscillate}, however its oscillations will be damped.
This is due to two factors: the expansion of the universe and the coupling of the field to other particles.

The damped oscillations are described by a coupled Klein-Gordon equation:
%
\begin{align}
\ddot{\varphi} + 3 H \dot{\varphi} + \Gamma _\varphi \dot{\varphi} = - V' (\varphi )
\,,
\end{align}
%
where \(\Gamma _\varphi \) is the \textbf{decay rate} of the inflaton field into other kinds of particles.
This has the same form as the expansion term: it is a damping term as well.

The energy density of the scalar field can be differentiated:
%
\begin{align}
\rho _\varphi &= \frac{1}{2} \dot{\varphi}^2 + V(\varphi )  \label{eq:scalar-field-energy-density}\\
\dot{\rho}_\varphi &= \dot{\varphi} \ddot{\varphi} + V' (\varphi ) \dot{\varphi}
\,,
\end{align}
%
into which we can substitute into the KG equation to get
%
\begin{align}
\dot{\rho}_\varphi + (3 H + \Gamma _\varphi ) \dot{\varphi}^2 = 0
\,.
\end{align}

The timescale of the oscillations of \(\varphi \) will be much smaller than \(H^{-1}\), the timescale of the expansion of the universe.

Oscillations at \(\varphi = \sigma \) will have a frequency \(\omega^2 = V''(\sigma )\), which is also the effective mass of the inflaton there, \(m^2_\varphi (\sigma )\).

Since \(\omega^2 \gg H^2\) (this is true since \(\eta _V \gg 1\)) we can take averages over a period of the relevant quantities:
%
\begin{align}
\expval{\dot{\varphi}^2} _{\text{period}} = \rho _\varphi
\,,
\end{align}
%
since in general \(\expval{\dot{\varphi}^2 / 2} = \expval{V}\) by the virial theorem: therefore, substituting into \eqref{eq:scalar-field-energy-density} we get \(\expval{\dot{\varphi}^2} = \rho _\varphi \).
Then our equation becomes
%
\begin{align}
\dot{\rho}_\varphi + 3 H \rho _\varphi =  - \Gamma _\varphi \rho _\varphi
\,,
\end{align}
%
which, neglecting \(\Gamma _\varphi \), looks like the continuity equation for nonrelativistic matter, which yields \(\rho _\varphi \propto a^{-3}\).
This is expected: we have used the fact that \(m^2_\varphi (\sigma ) \gg H^2\), which is saying that the scalar field is very massive.

In the spirit of keeping things simple, we will use a toy model and assume that all the decay products of \(\varphi \) are relativistic, whose continuity equation is
%
\begin{align}
\dot{\rho} _R + 4 H \rho _R = + \Gamma _\varphi  \rho _\varphi
\,,
\end{align}
%
by conservation of energy. This equation comes from \(\nabla_\nu T^{\mu \nu } = 0\).
Gravity will then be described by the first Friedmann equation:
%
\begin{align}
H^2 = \frac{8 \pi G}{3} \qty(\rho _\varphi + \rho _R)
\,.
\end{align}

We have a simple and exact solution:
%
\begin{align}
\rho _\varphi = M^{4} \qty(\frac{a}{a _{\text{osc}}})^{-3} \exp(- \Gamma _\varphi \qty(t - t _{\text{osc}}))
\marginnote{See \cite[eq. 8.30]{kolbEarlyUniverse1994}.}
\,,
\end{align}
%
where \(t _{\text{osc}}\) and \(a _{\text{osc}}\) correspond to the time at which oscillations start, and \(M^{4} = \rho _\varphi ( t _{\text{osc}})\).
As a first approximation, this is the height of the potential the field is ``falling from'': \(M^{4} \sim V(\varphi = 0)\).

Let us consider the evolution up to the time \(t \approx \Gamma _\varphi^{-1}\). Then, the decay will not have been very efficient yet, and the universe will still be nonrelativistic matter (\(\varphi \)) dominated, so we will have \(a \propto t^{2/3}\).

The time of the start of oscillation will be
%
\begin{align}
t _{\text{osc}} \approx H^{-1} = \frac{M_P}{M^2}
\,,
\end{align}
%
since at the start of oscillations
%
\begin{align}
H^2 \approx \frac{8 \pi G}{3} M^{4} \approx \frac{M^2}{M_P}
\,.
\end{align}

So,
%
\begin{align}
\dot{\rho}_R + 4 H \rho _R &= \Gamma _\varphi M^4  \qty( \frac{a}{a _{\text{osc}}})^{-3} \\
\dot{\rho}_R + \frac{8}{3} \frac{\rho _R}{t} &=
\Gamma _\varphi M^{4} \qty( \frac{t}{t _{\text{osc}}})^{-2}
\,,
\end{align}
%
since \(a \propto t^{2/3}\) (we are in a matter-like dominated phase), therefore \(H = (2/3) t^{-1}\).
With a powerlaw ansatz \(\rho _R = B t^{\alpha }\) we get
%
\begin{align}
\alpha t^{\alpha -1} + \frac{8}{3} \frac{t^{\alpha }}{t} = \frac{\Gamma _\varphi }{B} M^{4} \qty(\frac{t}{ t _{\text{osc}}})^{-2}
\,,
\end{align}
%
the homogeneous solution is given by \(\alpha = - 8 /3\), while the particular has \(\alpha = -1\).

The initial condition we set is \(\rho _R (t _{\text{osc}}) = 0\), since before reheating inflation was taking place, diluting the energy density of radiation.
This yields, in the pre-radiation-domination epoch:
%
\begin{align}
\rho _R \approx \Gamma _\varphi M_P^2 \frac{9}{40 \pi } \frac{1}{t} \qty[ 1 - \qty( \frac{t}{t _{\text{osc}}})^{-5/3}]
\,.
\end{align}

\todo[inline]{Where does the \(\pi \) come from?}

% \todo[inline]{So, we are basically approximating the decaying exponential with a constant function for a small region of time, and then 0?}

Starting from this solution, and using \(a \propto t^{2/3}\), we find
%
\begin{align}
\rho _R = \frac{\num{.4}}{\pi^{1/2}} \Gamma _\varphi M_P M^2 \qty(\frac{a}{a _{\text{osc}}})^{-3/2} \qty[1 - \qty(\frac{a}{a _{\text{osc}}})^{- 5/2}]
\,.
\end{align}

The maximum energy density of radiation will be roughly given by \(\rho _R^{\text{max}} \approx \Gamma _\varphi M_P M^2\).
\marginnote{The \(a\)-dependent part has a maximum value of roughly \num{.35}.}

The radiation energy density will be given by \(\rho _R = \frac{\pi^2}{30} g_* T^{4}\), so the maximum temperature will be
%
\begin{align}
T^{\text{max}} = g_*^{-1/4} \rho _R^{\text{max}, 1/4} \sim g_*^{-1/4} \qty(\Gamma _\varphi M_P M^2)^{1/4}
\,.
\end{align}

In the reheating phase the energy density scales like \(\rho _R \propto a^{- 3/2}\): it is \emph{decreasing}, but much \emph{slower} than the usual \(\rho _R \propto a^{-4}\).

Let us also discuss the entropy:
%
\begin{align}
^*S = s a^3 &&
s = \frac{2 \pi^2}{45} g_{*s} T^3
\,,
\end{align}
%
so, since \(\rho _R \propto a^{-3/2}\) and \(\rho _R \propto T^{4}\) we have \(s \propto \rho _R^{3/4} \propto a^{- 9/8}\), therefore
%
\begin{align}
S \propto a^3 a^{-9/8} = a^{15/8}
\,.
\end{align}

It makes sense that this is increasing.

What is the \emph{reheating temperature}? We want to match the inflationary solution and the radiation-dominated solution.

Since we are in the radiation-dominated phase, we have \(a \propto t^{1/2}\): so
%
\begin{align}
H^2 = \frac{8 \pi G}{3} \rho _R = \frac{8 \pi }{3} \frac{1}{M_P^2} \frac{\pi^2}{30} g_* T^{4} = \frac{1}{4t^2}
\,.
\end{align}

The reheating temperature can be computed as the temperature at \(T_{RH} = T (t \approx \Gamma _\varphi^{-1})\).
Plugging this in, we get
%
\begin{align} \label{eq:reheating-temperature}
T_{RH} \approx \num{.55} g_*^{-1/4} \sqrt{\Gamma _\varphi M_P}
\,.
\end{align}

What is interesting to note here is that there is no memory of the energy scale \(M\), the vacuum energy scale of inflation.
\todo[inline]{Add comment about the redshift of the inflaton's energy}

Only if \(\Gamma _\varphi \gg H _{\text{osc}}\) we would have had \(T_{RH} \sim M\); in that case the reheating would have been \SI{100}{\percent} efficient, the harmonic oscillator would have been overdamped.

Note that the maximum temperature reached in the reheating phase is different from the reheating temperature.

See \cite[fig.\ 8.3]{kolbEarlyUniverse1994}.

\section{Boltzmann equation applications}

A usual rule of thumb is given in terms of the interaction rate \(\Gamma = n \sigma \abs{v}\): if \(\Gamma \gtrsim H\) thermal equilibrium can be established, while if \(\Gamma < H\) interactions become inefficient.

If, roughly speaking, \(T \propto a^{-1}\), then \(\dot{T} / T = - H\).

When \(\Gamma \sim H\), we need the Boltzmann equation in order to find out what exactly is going on.
Let us give two examples.

\(2 \leftrightarrow 2\) scattering between relativistic particles may be mediated by a massless boson, such as the photon, or by a massive boson, such as the \(W^{\pm}\) or \(Z^{0}\) boson.

In the first (massless boson) case, we have
%
\begin{align}
\sigma \sim \frac{\alpha^2}{T^2} && \alpha = \frac{g^2}{4 \pi }
\,,
\end{align}
%
while in the second (massive boson) case we have
%
\begin{align}
\sigma \sim G_X^2 T^2 && G_X = \frac{\alpha }{m_X^2}
\,.
\end{align}

Roughly speaking,
%
\begin{align}
\sigma \sim \alpha^2\abs{\text{propagator}}^2 \frac{q^{4}}{E^2}
\,,
\end{align}
%
where \(q\) is the spatial momentum of the interacting particles, while \(E\) is the center of mass energy, so for relativistic particles \(q^{4}/ E^2 \sim E^2 \sim T^2\).

In the massless boson case, the propagator looks like
%
\begin{align}
\text{propagator} \sim \frac{-i g_{\mu \nu }}{p^2}
\,,
\end{align}
%
where \(p^2 =(q_1 + q_2 )^2\).
Then, the cross-section looks like \(\sigma \sim \alpha^2 / T^2\) typically.

In the massive boson case, we have
%
\begin{align}
\text{propagator} \sim \frac{- i g_{\mu \nu } + p_{\mu } p_{\nu } / m_X^2}{p^2-  m_X^2}
\,,
\end{align}
%
so \(\sigma \sim \alpha^2 T^2 / m_X^{4}\).

In the massless boson case, then,
%
\begin{align}
\Gamma = n \sigma \abs{v} \approx n \sigma
\,,
\end{align}
%
so if \(n \sim T^3\) (which is the case if we have radiation domination and equilibrium) we get \(\Gamma = \alpha^2 T\). We want to know when this will be larger than \(H\), using the fact that
%
\begin{align}
H \sim \frac{T^2}{M_P} && H^2 = \frac{8 \pi G}{3} \underbrace{\rho _R}_{\propto T^{4}}
\,,
\end{align}
%
so \(\Gamma \gtrsim H\) when \(T < \alpha^2 M_P \sim \SI{e15}{GeV}\).

For the massive gauge boson, at temperatures \(T \ll m_X\) we get \(\Gamma \gtrsim H\) when
%
\begin{align}\label{eq:massive-gauge-boson-cross-section}
\Gamma = G_X^2 T^{5} &\gtrsim \frac{T^2}{M_P}  \\
T &\gtrsim G_X^{-2/3} M_P^{-1/3}
\,.
\end{align}

With normalization reflecting the case of weak interactions, and using \(G_X \sim \alpha / m_X^2\), we find
%
\begin{align}
T \gtrsim \qty(\frac{m_X}{\SI{100}{GeV}})^{4/3} \SI{1}{MeV}
\,,
\end{align}
%
which can be used to figure out when neutrinos decouple.

\end{document}


\subsection{Choice of spectrograph parameters}

As a spectrograph, we decided on Horiba iHR550 Imaging Spectrometer with
aperture f/6.4, focal length 550 mm, magnification 1.1, and triple-grating
turret, so we needed to select three gratings with the best parameters for our
purpose.
One grating position we reserved for fluorescence measurements with 300 gr/mm,
but gratings for the other two positions needed to be selected based on the
required spectral range and dispersion.
We neglected all the nonlinearities of dispersion dependence on wavelength
for spectral range estimation and used dispersions from spectrograph sale
materials shown in
\tabref{spectrograph_selection:dispersion_spec}
for available gratings.

\begin{table}
	\centering
	\input{results_and_discussion/assets/spectrograph_dispersion_spec}
	\caption[%
		Grating dispersion specifications taken from Horiba iHR550
		specification document.%
	]{%
		\captiontitle{%
			Grating dispersion specifications taken from Horiba iHR550
			specification document.%
		}
		The linear dispersion
		$\frac{\text{d}\lambda}{\text{d}x}$ defines how a spectral interval is
		spread across the focal field.
	}
	\label{\tablabel{spectrograph_selection:dispersion_spec}}
\end{table}

Then we used the Raman wavenumber $\tilde{\nu}$ calculation equation from
the laser excitation wavelength in the air $\lambda_\text{e}$ and Stokes Raman
signal wavelength $\lambda_\text{R}$
\begin{equation}
	\tilde{\nu} = \frac{1}{\lambda_\text{e}} - \frac{1}{\lambda_\text{R}}
	\label{\eqnlabel{spectrograph_selection:nu}}
\end{equation}
to calculate the maximal measured wavenumber $\tilde{\nu}_2$ from the
$\tilde{\nu}_1 = 200$\,\icm{} for all the available excitation wavelengths
from our Ar\textsuperscript{+} ion frequency-doubled laser according to formula
\begin{equation}
	\tilde{\nu}_2 = \lambda_\text{e}^{-1}
		- \left(\frac{1}{\lambda_\text{e}^{-1} - \tilde{\nu}_1}
			+ w\frac{\text{d}\lambda}{\text{d}x}\right)^{-1},
	\label{\eqnlabel{spectrograph_selection:spectral_range_max_est}}
\end{equation}
where $w$ denotes the width of a CCD camera and
$\frac{\text{d}\lambda}{\text{d}x}$
grating linear dispersion, which defines the extent to which a spectral
interval is spread out across the focal field.
We also calculated minimal measured wavenumber $\tilde{\nu}_1$ from the maximal
$\tilde{\nu}_2 = 4000$\,\icm{} using the formula
\begin{equation}
	\tilde{\nu}_1 = \lambda_\text{e}^{-1}
		- \left(\frac{1}{\lambda_\text{e}^{-1} - \tilde{\nu}_2}
			- w\frac{\text{d}\lambda}{\text{d}x}\right)^{-1}.
	\label{\eqnlabel{spectrograph_selection:spectral_range_min_est}}
\end{equation}

The average wavenumber dispersion per pixel can be calculated from these
values as
\begin{equation}
	\bar{d} = \frac{\tilde{\nu}_2 - \tilde{\nu}_1}{N_w},
	\label{\eqnlabel{spectrograph_selection:dispersion_est}}
\end{equation}
where $N_w = 2048$ is number of camera width pixels.
The results based on the dispersion data specified by the vendor can be seen in
\tabref{spectrograph_selection:dispersion_est}.

\begin{table}
	\centering
	\input{results_and_discussion/assets/spectrograph_dispersion_est}
	\caption[%
		Estimated Raman-shift ranges that can be captured by CCD detector
		for particular available excitation wavelengths.%
	]{%
		\captiontitle{%
			Estimated Raman-shift ranges that can be captured by CCD detector
			for particular available excitation wavelengths.%
		}
		Gratings are denoted by the number of grooves per mm, $\tilde{\nu}_1$ and
		$\tilde{\nu}_2$ are the lowest and highest detected frequencies in \icm{}
		calculated according to
		\cref{%
			\eqnlabel{spectrograph_selection:spectral_range_max_est},%
			\eqnlabel{spectrograph_selection:spectral_range_min_est}%
		},
		respectively. The $\bar{d}$ denotes average dispersion in \icm/px
		calculated from
		\eqnref{spectrograph_selection:dispersion_est}.
	}
	\label{\tablabel{spectrograph_selection:dispersion_est}}
\end{table}

We can see that if we want to cover the full Raman vibration range from the
low-frequency vibrations of 200\,\icm{} to valence hydrogen stretching
vibrations of 4000\,\icm{} at all possible excitation wavelengths, we need to
select grating with 1200\,gr/mm.
For the Raman fingerprint region below 1800\,\icm{}, we must choose the
grating with 2400\,gr/mm.

So, finally, we chose grating with 300\,gr/mm for possible fluorescence
measurements 1200\,gr/mm for the measurement of the full range, including
valence hydrogen stretching vibrations at higher wavelengths (e.g., 257\,nm
excitation), and 2400\,gr/mm for the Raman fingerprint region measurements.

After the gratings were installed, the predictions from spectrograph vendor
sale materials were evaluated on actual experiment and with the help of
diffraction grating theory and spectrograph and CCD camera specifications.
The values in the table were adjusted for possible future evaluation of the
extension of our experimental capabilities.
We measured spectra of Pt lamp for different positions of spectrograph and
calibrated the spectra to themselves
(\cref{wavenumber_calibration}).
Then the lower ($\lambda_1$) and upper ($\lambda_2$) bound wavelengths from
each spectrum were taken, and dependences of the measured range
($\Delta\lambda = \lambda_2 - \lambda_1$)
on these bounds were investigated.

The diffraction of light on the grating follows the grating equation
\begin{equation}
	a(\sin\alpha_\text{i} + \sin\alpha_m) = m\lambda,
	\label{\eqnlabel{spectrograph_selection:grating_equation}}
\end{equation}
where $\alpha_\text{i}$ is the incident light angle,
	$\alpha_m$ is diffraction angle to the $m$-th diffraction order,
	$\lambda$ is diffracted light wavelength,
	and $a$ is grating constant.
The directions of the angles $\alpha$ can be seen in
\figref{spectrograph_selection:configuration_schema}.

\begin{figure}
	\centering
	\input{results_and_discussion/assets/spectrograph_configuration}
	\caption[%
		Spectrograph configuration schema.%
	]{%
		\captiontitle{%
			Spectrograph configuration schema.%
		}
	}
	\label{\figlabel{spectrograph_selection:configuration_schema}}
\end{figure}

The grating constant can be calculated from the number of grooves per mm
$N_\text{gr}$ as
\begin{equation*}
	a = \frac{1}{N_\text{gr}}.
\end{equation*}

We can also derive the angular dispersion
$\frac{\text{d}\alpha_m}{\text{d}\lambda}$
of the grating from
\eqnref{spectrograph_selection:grating_equation}
for the fixed incident light angle $\alpha_\text{i}$ as

\begin{equation}
	\frac{\text{d}\alpha_m}{\text{d}\lambda} = \frac{m}{a\cos\alpha_m}.
	\label{\eqnlabel{spectrograph_selection:angular_dispersion}}
\end{equation}

The selected spectrograph uses the Czerny-Turner configuration in which the
diffracted light is focused onto the detector plane by the focussing mirror
with effective focal length $f$, which converts angular dispersion to
dispersion on the detector plane with coordinate $x$ as
\begin{equation*}
	\frac{\text{d}x}{\text{d}\lambda} =
		f\frac{\text{d}\alpha_m}{\text{d}\lambda}
\end{equation*}
and inverting the equation and using
\eqnref{spectrograph_selection:angular_dispersion}
we get linear dispersion
\begin{equation}
	\frac{\text{d}\lambda}{\text{d}x} = \frac{a\cos\alpha_m}{fm}.
	\label{\eqnlabel{spectrograph_selection:linear_dispersion}}
\end{equation}

We can see that linear dispersion for a fixed grating position is independent
of the light wavelength but, for a typical spectrograph, the angle between the
incident and diffracted light $\varphi$, called \emph{Ebert angle}, is fixed by
the spectrograph geometry and the diffracted light wavelength is selected by
rotation of diffraction grating by angle $\vartheta_m$.
So, it is helpful to transform
\eqnref{spectrograph_selection:grating_equation}
to these variables.
Following the direction of angles denoted in
\figref{spectrograph_selection:configuration_schema},
we can derive
\begin{equation}
	\alpha_\text{i} = \vartheta_m - \frac{\varphi}{2}\ ,
	\alpha_m = \vartheta_m + \frac{\varphi}{2}
	\label{\eqnlabel{spectrograph_selection:ebert_transformation}}
\end{equation}
and put that into
\eqnref{spectrograph_selection:grating_equation},
and using the goniometric formula for summation of two sine functions, we get
\begin{equation}
	2a\sin\vartheta_m\cos\frac{\varphi}{2} = m\lambda.
	\label{\eqnlabel{spectrograph_selection:grating_equation_ebert}}
\end{equation}

As we previously said, for a typical spectrograph, we usually do not know
diffraction angle $\alpha_m$ but rather the Ebert angle $\phi$, and we can
measure the diffracted light wavelength $\lambda$ by comparison to the source
of light with known wavelength so using
\eqnref{spectrograph_selection:grating_equation_ebert},
we can calculate grating rotation angle
\begin{equation}
	\vartheta_m = \text{arcsin}\left(
		\frac{m\lambda}{2a\cos\frac{\varphi}{2}}\right)
	\label{\eqnlabel{spectrograph_selection:grating_rotation_angle}}
\end{equation}
which can be used in combination with
\cref{%
	\eqnlabel{spectrograph_selection:ebert_transformation},%
	\eqnlabel{spectrograph_selection:linear_dispersion}%
}
for linear dispersion calculation.

All the parameters for the linear dispersion calculation can be retrieved from
the spectrograph documentation and are summarized in
\tabref{spectrograph_selection:dispersion_params}.

\begin{table}
	\centering
	\input{results_and_discussion/assets/dispersion_params}
	\caption[%
		Spectrograph and CCD parameters for dispersion calculation.%
	]{%
		\captiontitle{%
			Spectrograph and CCD parameters for dispersion calculation.%
		}
		All the values are taken from the spectrograph and CCD specification
		documents.
	}
	\label{\tablabel{spectrograph_selection:dispersion_params}}
\end{table}

We cannot measure linear dispersion directly, but we can measure it, for
example, from the spectral range captured by the used CCD camera
\begin{equation*}
	\Delta\lambda = \lambda_2 - \lambda_1
\end{equation*}
divided by the length of the CCD camera $l_\text{CCD}$, because in the first
approximation of
\eqnref{spectrograph_selection:linear_dispersion},
the linear dispersion is not dependent on the diffracted light wavelength.
So, we can relate the experimentally measured spectral range to the dispersion
by equation
\begin{equation}
	\Delta\lambda = l_\text{CCD}\frac{\text{d}\lambda}{\text{d}x}.
	\label{\eqnlabel{spectrograph_selection:measured_range}}
\end{equation}

The last unknown in this equation is the wavelength $\lambda$ for the Ebert
angle $\varphi$, but we can calculate it in the linear dispersion approximation
as the center of the measured spectral range
\begin{equation*}
	\lambda = \frac{\lambda_1 + \lambda_2}{2}.
\end{equation*}

As we want to compare the theoretical and experimental values, the least
precise parameter from the description of the instrument was the camera size,
so we fitted
\eqnref{spectrograph_selection:measured_range}
to the measured ranges with the camera length $l_\text{CCD}$ as a parameter for
grating with 1200 and 2400\,gr/mm, the results can be seen in
\tabref{spectrograph_selection:detector_length_fits}
and dependences of the spectral ranges on wavelength are plotted in
\figref{spectrograph_selection:dispersion_range}.
It can be seen from
\tabref{spectrograph_selection:detector_length_fits}
that the detector length estimation difference between grating
with 1200\,gr/mm and 2400\,gr/mm is slightly larger than the estimated
standard deviations.
It can be attributed to the slight inaccuracy in the used Ebert angle, but the
difference is so small that we decided not to pursue its
further refinement by a more complicated nonlinear fit.

\begin{table}
	\centering
	\input{results_and_discussion/assets/detector_length_fits}
	\caption[%
		Results of fits of dispersion in dependence on a wavelength with
		detector length as a parameter for different gratings.%
	]{%
		\captiontitle{%
			Results of fits of dispersion in dependence on a wavelength with
			detector length as a parameter for different gratings.%
		}
	}
	\label{\tablabel{spectrograph_selection:detector_length_fits}}
\end{table}

\begin{figure}
	\centering
	\begin{subfigure}[b]{1\textwidth}
		\centering
		\input{results_and_discussion/assets/spectrograph_dispersion_meas/%
bounds_1200_range}
		\caption{The grating with 1200\,gr/mm.}
		\label{\figlabel{spectrograph_selection:dipsersion_range_1200}}
	\end{subfigure}
	\\
	\begin{subfigure}[b]{1\textwidth}
		\centering
		\input{results_and_discussion/assets/spectrograph_dispersion_meas/%
bounds_2400_range}
		\caption{The grating with 2400\,gr/mm.}
		\label{\figlabel{spectrograph_selection:dipsersion_range_2400}}
	\end{subfigure}
	\caption[%
		Plots of spectral ranges captured by the detector in dependence on
		the central detected wavelength for different gratings.%
	]{%
		\captiontitle{%
			Plots of spectral ranges captured by the detector in dependence on
			the central detected wavelength $\lambda$ for different gratings.%
		}
		Solid lines represent theoretical curves following
		\eqnref{spectrograph_selection:measured_range}
		with parameters from
		\tabref{spectrograph_selection:dispersion_params}
		but for the length of CCD chip $l_\text{CCD}$ which is the average of
		estimates from fits summarized in
		\tabref{spectrograph_selection:detector_length_fits}.
	}
	\label{\figlabel{spectrograph_selection:dispersion_range}}
\end{figure}

We want to calculate the similar table to
\tabref{spectrograph_selection:dispersion_est}
now.
For that purpose, we need to estimate the $\lambda_2$ if we know $\lambda_1$ or
vice versa.
We can use the grating equation
(\eqnref{spectrograph_selection:grating_equation})
using
\cref{%
	\eqnlabel{spectrograph_selection:ebert_transformation},%
	\eqnlabel{spectrograph_selection:grating_rotation_angle}%
}
with Ebert angle $\phi$ modified by view angle of detector length
$\beta$ for the rays pointing to the detector edges instead of the center
\begin{align}
	\begin{split}
		\varphi_1 = \varphi - \beta / 2    &= 11.606^\circ, \\
		\varphi_2 = \varphi + \beta / 2    &= 14.386^\circ, \\
		\beta     = \frac{l_\text{CCD}}{f} &=  2.781^\circ,
	\end{split}
	\label{\eqnlabel{spectrograph_selection:modified_ebert_angles}}
\end{align}
where $\varphi_1$ and $\varphi_2$ stay for Ebert angles to the beginning and
end of the detector respectively.
The results are summarized in
\tabref{spectrograph_selection:dispersion_meas}.

\begin{table}
	\centering
	\input{results_and_discussion/assets/spectrograph_dispersion_meas}
	\caption[%
		Spectrograph dispersion estimation.%
	]{%
		\captiontitle{%
			Spectrograph dispersion estimation.%
		}
		These are the same values as in
		\tabref{spectrograph_selection:dispersion_est}
		but are now calculated from
		\cref{%
			\eqnlabel{spectrograph_selection:grating_equation},%
			\eqnlabel{spectrograph_selection:ebert_transformation},%
			\eqnlabel{spectrograph_selection:grating_rotation_angle},%
			\eqnlabel{spectrograph_selection:nu}%
		},
		with Ebert angle values calculated in
		\eqnref{spectrograph_selection:modified_ebert_angles}.
		Gratings are denoted by the number of grooves per mm; $\tilde{\nu}_1$ and
		$\tilde{\nu}_2$ are the lowest and highest detected frequencies in \icm.
		The $\bar{d}$ denotes average dispersion in \icm/px calculated from
		\eqnref{spectrograph_selection:dispersion_est}.
	}
	\label{\tablabel{spectrograph_selection:dispersion_meas}}
\end{table}

These results from
\tabref{spectrograph_selection:dispersion_meas}
show that the real ranges are significantly higher than the values
estimated from the spectrograph sale materials
(\tabref{spectrograph_selection:dispersion_est}),
especially for the gratings with higher groove densities.
It can be seen from these results that the 3600\,gr/mm grating would be more
suitable for the Raman fingerprint region than the 2400\,gr/mm one.